HomeClusterLabs Projects

Refactor: libpe_rules,libcrmcommon: move single-rule evaluation to libcrmcommon

Description

Refactor: libpe_rules,libcrmcommon: move single-rule evaluation to libcrmcommon

Move the contents of pe_eval_expr() from libpe_rules to libcrmcommon as
pcmk_evaluate_rule(), and the contents of pe_eval_subexpr() as
pcmk__evaluate_condition(). Together, these evaluate a single rule including
all of its expressions. (Documentation will soon refer to "an expression or
subrule" as a "condition", so that terminology is adopted now.)

Use the new functions internally instead of the old ones and their wrappers,
pe_test_rule() and pe_test_expression().

The new functions use pcmk_rule_input_t instead of pe_rule_eval_data_t, and
return a standard code instead of gboolean. The old functions are kept (for
now) as wrappers that map the old struct to the new.

No code changes other than the minimum necessary to use the new struct and
return value (including using the new evaluation functions directly rather than
via wrappers).

Details

Provenance
kgaillotAuthored on Feb 8 2024, 4:06 PM
Parents
rP6acac7f2b21d: Merge pull request #3401 from kgaillot/best-practices
Branches
Unknown
Tags
Unknown