View Source amoc_coordinator (amoc v3.0.0-rc1)

This module allows to synchronize the users and act on groups of them.

Link to this section 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.
Starts a coordinator. Usually called in the init callback of an amoc scenario.
Stops a coordinator.

Link to this section Types

-type coordination_action() ::
    fun((coordination_event(), [coordination_data()]) -> any()) |
    fun((coordination_event(), maybe_coordination_data(), maybe_coordination_data()) -> any()) |
    fun((coordination_event()) -> any()).
Link to this type

coordination_actions/0

View Source
-type coordination_actions() :: [coordination_action()] | coordination_action().
-type coordination_data() :: {pid(), Data :: any()}.
-type coordination_event() :: {coordination_event_type(), non_neg_integer()}.
Link to this type

coordination_event_type/0

View Source
-type coordination_event_type() :: coordinate | timeout | stop | reset.
-type coordination_item() :: {NoOfUsers :: pos_integer() | all, coordination_actions()}.
-type coordination_plan() :: [coordination_item()] | coordination_item().
Link to this type

coordination_timeout_in_sec/0

View Source
-type coordination_timeout_in_sec() :: pos_integer() | infinity.
Link to this type

maybe_coordination_data/0

View Source
-type maybe_coordination_data() :: coordination_data() | undefined.
-type name() :: atom().
Link to this type

normalized_coordination_item/0

View Source
-type normalized_coordination_item() :: {NoOfUsers :: pos_integer() | all, [coordination_action()]}.
-type state() :: {worker, name(), pid()} | {timeout, name(), pid()}.

Link to this section Functions

-spec add(name(), any()) -> ok.

See also: add/3.

-spec add(name(), pid(), any()) -> ok.
Adds the current process data. Usually called in the start/2 callback of an amoc scenario.
-spec reset(name()) -> ok.
Resets a coordinator, that is, calls all coordination actions with reset as the coordination data.
Link to this function

start(Name, CoordinationPlan)

View Source
-spec start(name(), coordination_plan()) -> ok | error.

See also: start/3.

Link to this function

start(Name, CoordinationPlan, Timeout)

View Source
-spec start(name(), coordination_plan(), coordination_timeout_in_sec()) -> ok | error.
Starts a coordinator. Usually called in the init callback of an amoc scenario.
-spec stop(name()) -> ok.
Stops a coordinator.