RaftFleet.add_consensus_group

You're seeing just the function add_consensus_group, go back to RaftFleet module for more information.
Link to this function

add_consensus_group(name)

View Source

Specs

add_consensus_group(atom()) ::
  :ok | {:error, :already_added | :cleanup_ongoing | :no_leader | any()}

Registers a new consensus group identified by name.

This is a simplified version of add_consensus_group/3, where

  • n_replica is filled with 3 (fixed value) and
  • rv_config is computed using the module given as :rafted_value_config_maker option (see also RaftFleet.Config).
Link to this function

add_consensus_group(name, n_replica, rv_config, await_timeout \\ 5000)

View Source

Specs

add_consensus_group(
  atom(),
  pos_integer(),
  RaftedValue.Config.t(),
  pos_integer()
) :: :ok | {:error, :already_added | :cleanup_ongoing | :no_leader | any()}

Registers a new consensus group identified by name.

name is used as the registered name for member processes of the new consensus group. n_replica is the number of replicas (Raft member processes implemented as RaftedValue.Server). If you want all active nodes to host member processes, specify sufficiently large integer as n_replica. For explanation of rv_config see RaftedValue.make_config/2.

If you configure raft_fleet to persist Raft logs & snapshots (see also RaftFleet.Config) and the consensus group with name had been removed by remove_consensus_group/1, then add_consensus_group/3 will restore the state of the consensus group from the snapshot and log files.

The caller is blocked until the newly spawned leader becomes ready. await_timeout specifies how many milliseconds to wait for the initialization.