View Source amoc_coordinator (amoc v3.3.0)

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

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.

Types

-type action() ::
    fun((coordination_event(), [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() :: [action()] | action().
-type coordination_event() :: {event_type(), non_neg_integer()}.
-type coordination_item() :: {num_of_users(), coordination_actions()}.
Link to this type

coordination_timeout_in_sec/0

View Source
-type coordination_timeout_in_sec() :: pos_integer() | infinity.
-type data() :: {pid(), Data :: any()}.
-type event() :: coordinator_timeout | reset_coordinator | {coordinate, {pid(), term()}}.
-type event_type() :: coordinate | timeout | stop | reset.
Link to this type

maybe_coordination_data/0

View Source
-type maybe_coordination_data() :: data() | undefined.
-type name() :: term().
Link to this type

normalized_coordination_item/0

View Source
-type normalized_coordination_item() :: {NoOfUsers :: pos_integer() | all, [action()]}.
-type num_of_users() :: pos_integer() | {Min :: pos_integer(), Max :: pos_integer()} | all.
-type plan() :: [coordination_item()] | coordination_item().

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 notify(name(), coordinator_timeout | reset_coordinator | {coordinate, {pid(), term()}}) -> ok.
-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(), plan()) -> ok | error.

See also: start/3.

Link to this function

start(Name, CoordinationPlan, Timeout)

View Source
-spec start(name(), 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.