diff --git a/include/crm/common/Makefile.am b/include/crm/common/Makefile.am index 83a4197e09..3269ecacff 100644 --- a/include/crm/common/Makefile.am +++ b/include/crm/common/Makefile.am @@ -1,44 +1,45 @@ # # Copyright 2004-2023 the Pacemaker project contributors # # The version control history for this file may have further details. # # This source code is licensed under the GNU General Public License version 2 # or later (GPLv2+) WITHOUT ANY WARRANTY. # MAINTAINERCLEANFILES = Makefile.in headerdir=$(pkgincludedir)/crm/common header_HEADERS = acl.h \ actions.h \ agents.h \ agents_compat.h \ cib.h \ ipc.h \ ipc_controld.h \ ipc_pacemakerd.h \ ipc_schedulerd.h \ iso8601.h \ logging.h \ logging_compat.h \ mainloop.h \ mainloop_compat.h \ nodes.h \ nvpair.h \ output.h \ resources.h \ results.h \ results_compat.h \ roles.h \ + rules.h \ scheduler.h \ scheduler_types.h \ tags.h \ tickets.h \ util.h \ util_compat.h \ xml.h \ xml_compat.h noinst_HEADERS = $(wildcard *internal.h) diff --git a/include/crm/common/rules.h b/include/crm/common/rules.h new file mode 100644 index 0000000000..d6d408a8f5 --- /dev/null +++ b/include/crm/common/rules.h @@ -0,0 +1,44 @@ +/* + * Copyright 2004-2023 the Pacemaker project contributors + * + * The version control history for this file may have further details. + * + * This source code is licensed under the GNU Lesser General Public License + * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. + */ + +#ifndef PCMK__CRM_COMMON_RULES__H +# define PCMK__CRM_COMMON_RULES__H + +#ifdef __cplusplus +extern "C" { +#endif + +/*! + * \file + * \brief Scheduler API for rules + * \ingroup core + */ + +/* Allowed subexpressions of a rule + * @COMPAT This should be made internal at an API compatibility break + */ +enum expression_type { + not_expr = 0, + nested_rule = 1, + attr_expr = 2, + loc_expr = 3, + role_expr = 4, + time_expr = 5, +#if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1) + version_expr = 6, +#endif + rsc_expr = 7, + op_expr = 8, +}; + +#ifdef __cplusplus +} +#endif + +#endif // PCMK__CRM_COMMON_RULES__H diff --git a/include/crm/common/scheduler.h b/include/crm/common/scheduler.h index 96f9a62187..b5c1cfa08d 100644 --- a/include/crm/common/scheduler.h +++ b/include/crm/common/scheduler.h @@ -1,238 +1,239 @@ /* * Copyright 2004-2023 the Pacemaker project contributors * * The version control history for this file may have further details. * * This source code is licensed under the GNU Lesser General Public License * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ #ifndef PCMK__CRM_COMMON_SCHEDULER__H # define PCMK__CRM_COMMON_SCHEDULER__H #include // time_t #include // xmlNode #include // guint, GList, GHashTable #include // crm_time_t #include #include #include #include +#include #include #include #include #ifdef __cplusplus extern "C" { #endif /*! * \file * \brief Scheduler API * \ingroup core */ //! Possible responses to loss of quorum enum pe_quorum_policy { pcmk_no_quorum_freeze, // pcmk_tag_t *) int blocked_resources; //!< Number of blocked resources in cluster int disabled_resources; //!< Number of disabled resources in cluster GList *param_check; //!< History entries that need to be checked GList *stop_needed; //!< Containers that need stop actions time_t recheck_by; //!< Hint to controller when to reschedule int ninstances; //!< Total number of resource instances guint shutdown_lock; //!< How long to lock resources (seconds) int priority_fencing_delay; //!< Priority fencing delay // pcmk__output_t * void *priv; //!< For Pacemaker use only guint node_pending_timeout; //!< Pending join times out after this (ms) }; #ifdef __cplusplus } #endif #endif // PCMK__CRM_COMMON_SCHEDULER__H diff --git a/include/crm/pengine/rules.h b/include/crm/pengine/rules.h index 264bd690a8..87dabd52ec 100644 --- a/include/crm/pengine/rules.h +++ b/include/crm/pengine/rules.h @@ -1,80 +1,66 @@ /* * Copyright 2004-2022 the Pacemaker project contributors * * The version control history for this file may have further details. * * This source code is licensed under the GNU Lesser General Public License * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ #ifndef PCMK__CRM_PENGINE_RULES__H # define PCMK__CRM_PENGINE_RULES__H # include # include # include +# include # include #ifdef __cplusplus extern "C" { #endif -enum expression_type { - not_expr = 0, - nested_rule = 1, - attr_expr = 2, - loc_expr = 3, - role_expr = 4, - time_expr = 5, -#if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1) - //! \deprecated Do not use (will be removed in a future release) - version_expr = 6, -#endif - rsc_expr = 7, - op_expr = 8, -}; - enum expression_type find_expression_type(xmlNode * expr); gboolean pe_evaluate_rules(xmlNode *ruleset, GHashTable *node_hash, crm_time_t *now, crm_time_t *next_change); gboolean pe_test_rule(xmlNode *rule, GHashTable *node_hash, enum rsc_role_e role, crm_time_t *now, crm_time_t *next_change, pe_match_data_t *match_data); gboolean pe_test_expression(xmlNode *expr, GHashTable *node_hash, enum rsc_role_e role, crm_time_t *now, crm_time_t *next_change, pe_match_data_t *match_data); void pe_eval_nvpairs(xmlNode *top, const xmlNode *xml_obj, const char *set_name, const pe_rule_eval_data_t *rule_data, GHashTable *hash, const char *always_first, gboolean overwrite, crm_time_t *next_change); void pe_unpack_nvpairs(xmlNode *top, const xmlNode *xml_obj, const char *set_name, GHashTable *node_hash, GHashTable *hash, const char *always_first, gboolean overwrite, crm_time_t *now, crm_time_t *next_change); char *pe_expand_re_matches(const char *string, const pe_re_match_data_t *match_data); gboolean pe_eval_rules(xmlNode *ruleset, const pe_rule_eval_data_t *rule_data, crm_time_t *next_change); gboolean pe_eval_expr(xmlNode *rule, const pe_rule_eval_data_t *rule_data, crm_time_t *next_change); gboolean pe_eval_subexpr(xmlNode *expr, const pe_rule_eval_data_t *rule_data, crm_time_t *next_change); #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1) #include #endif #ifdef __cplusplus } #endif #endif