View Source amoc_coordinator (amoc v3.0.0-rc2)
Summary
Functions
See also: add/3.
Adds the current process data. Usually called in the
start/2
callback of an amoc scenario.Resets a coordinator, that is, calls all coordination actions with
reset
as the coordination data.See also: start/3.
Starts a coordinator. Usually called in the init callback of an amoc scenario.
Stops a coordinator.
Types
-type coordination_action() :: fun((coordination_event(), [coordination_data()]) -> any()) | fun((coordination_event(), maybe_coordination_data(), maybe_coordination_data()) -> any()) | fun((coordination_event()) -> any()).
-type coordination_actions() :: [coordination_action()] | coordination_action().
-type coordination_data() :: {pid(), Data :: any()}.
-type coordination_event() :: {coordination_event_type(), non_neg_integer()}.
-type coordination_event_type() :: coordinate | timeout | stop | reset.
-type coordination_item() :: {NoOfUsers :: pos_integer() | all, coordination_actions()}.
-type coordination_plan() :: [coordination_item()] | coordination_item().
-type coordination_timeout_in_sec() :: pos_integer() | infinity.
-type maybe_coordination_data() :: coordination_data() | undefined.
-type name() :: atom().
-type normalized_coordination_item() :: {NoOfUsers :: pos_integer() | all, [coordination_action()]}.
-type state() :: {worker, pid()} | {timeout, name(), pid()}.
Functions
-spec add(name(), any()) -> ok.
See also: add/3.
-spec add(name(), pid(), any()) -> ok.
start/2
callback of an amoc scenario.
-spec reset(name()) -> ok.
reset
as the coordination data.
-spec start(name(), coordination_plan()) -> ok | error.
See also: start/3.
-spec start(name(), coordination_plan(), coordination_timeout_in_sec()) -> ok | error.
-spec stop(name()) -> ok.