Module cartridge.confapplier

Clusterwide configuration management primitives.

Functions

get_readonly ([section_name]) Get a read-only view on the clusterwide configuration.
get_deepcopy ([section_name]) Get a read-write deep copy of the clusterwide configuration.
patch_clusterwide (patch) Edit the clusterwide configuration.

Local Functions

get_known_roles () List all registered roles names.
get_enabled_roles (roles) Roles to be enabled on the server.
get_role_dependencies (role_name) List role dependencies.
load_from_file (filename) Load configuration from the filesystem.
fetch_from_membership () Fetch configuration from another instance.
validate_config (conf_new, conf_old) Validate configuration by all roles.
apply_config (conf) Apply the role configuration.
prepare_2pc (conf) Two-phase commit - preparation stage.
commit_2pc () Two-phase commit - commit stage.
abort_2pc () Two-phase commit - abort stage.


Functions

get_readonly ([section_name])
Get a read-only view on the clusterwide configuration.

Returns either conf[section_name] or entire conf. Any attempt to modify the section or its children will raise an error.

Parameters:

  • section_name string (optional)

Returns:

    table
get_deepcopy ([section_name])
Get a read-write deep copy of the clusterwide configuration.

Returns either conf[section_name] or entire conf. Changing it has no effect unless it's used to patch clusterwide configuration.

Parameters:

  • section_name string (optional)

Returns:

    table
patch_clusterwide (patch)
Edit the clusterwide configuration. Top-level keys are merged with the current configuration. To remove a top-level section, use patch_clusterwide{key = box.NULL}.

The function uses a two-phase commit algorithm with the following steps:

I. Patches the current configuration.

II. Validates topology on the current server.

III. Executes the preparation phase (prepare_2pc) on every server excluding the following servers: expelled, disabled, and servers being joined during this call.

IV. If any server reports an error, executes the abort phase (abort_2pc). All servers prepared so far are rolled back and unlocked.

V. Performs the commit phase (commit_2pc). In case the phase fails, an automatic rollback is impossible, the cluster should be repaired manually.

Parameters:

  • patch table A patch to be applied.

Returns:

    boolean true

Or

  1. nil
  2. table Error description

Local Functions

get_known_roles ()
List all registered roles names.

Hidden roles are not listed as well as permanent ones.

Returns:

    {string,..}
get_enabled_roles (roles)
Roles to be enabled on the server. This function returns all roles that will be enabled including their dependencies (bot hidden and not) and permanent roles.

Parameters:

Returns:

    {[string]=boolean,...}
get_role_dependencies (role_name)
List role dependencies. Including sub-dependencies.

Parameters:

Returns:

    {string,..}
load_from_file (filename)
Load configuration from the filesystem. Configuration is a YAML file.

Parameters:

  • filename optional string Filename to load. When omitted, the active configuration is loaded from <workdir>/config.yml.

Returns:

    table

Or

  1. nil
  2. table Error description
fetch_from_membership ()
Fetch configuration from another instance.
validate_config (conf_new, conf_old)
Validate configuration by all roles.

Parameters:

Returns:

    boolean true

Or

  1. nil
  2. table Error description
apply_config (conf)
Apply the role configuration.

Parameters:

Returns:

    boolean true

Or

  1. nil
  2. table Error description
prepare_2pc (conf)
Two-phase commit - preparation stage.

Validate the configuration and acquire a lock writing <workdir>/config.prepate.yml. If the validation fails, the lock is not acquired and does not have to be aborted.

Parameters:

Returns:

    boolean true

Or

  1. nil
  2. table Error description
commit_2pc ()
Two-phase commit - commit stage.

Back up the active configuration, commit changes to filesystem, release the lock, and configure roles. If any errors occur, configuration is not rolled back automatically. Any problem encountered during this call has to be solved manually.

Returns:

    boolean true

Or

  1. nil
  2. table Error description
abort_2pc ()
Two-phase commit - abort stage.

Release the lock for further commit attempts.

Returns:

    boolean true
generated by LDoc 1.4.6 Last updated 2019-10-21 20:12:56