HomeClusterLabs Projects

Refactor: based, libcib: Use a single cib_operation_t table

Description

Refactor: based, libcib: Use a single cib_operation_t table

Now all the cib_operation_t data that's shared between based and
cib_file.c is in lib/cib/cib_ops.c, rather than duplicated.
pacemaker-based and CIB file clients have different CIB op functions,
and the ones defined in pacemaker-based aren't visible to libcib. So
unfortunately we must keep separate cib_op_fn_t tables in each.

pacemaker-based and cib_file.c each have a short op function getter
whose contents are identical but reference a different static array of
functions. The array is indexed by the type member of a cib_operation_t
object.

The use of enum cib__op_type values as keys is not strictly necessary,
but it's less error-prone than ensuring the order remains consistent
across arrays. It also allows us to skip functions for operations that
aren't supported for CIB file clients, without losing clarity.

We now have a new shared cib__get_operation() function as well, which
replaces similarly named functions from based and libcib.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>

Details

Provenance
nrwahl2Authored on Jul 4 2023, 5:07 AM
Parents
rPe94299f07350: Refactor: based: Rename based_common.c to based_operation.c
Branches
Unknown
Tags
Unknown