amoc_controller (amoc v4.2.0)

View Source

Main controller of a node, responsible for the scenario and the users

Note that this module should be rarely used, APIs are fully exposed by amoc and amoc_dist for local or distributed environments respectively.

Summary

Types

Status of the node, note that amoc_controller is disabled for the master node

Highest user id registered in the node

Details about the scenario currently running

Number of users currently running in the node

Types

amoc_status/0

-type amoc_status() ::
          idle |
          {running, running_status()} |
          {terminating, amoc:scenario()} |
          {finished, amoc:scenario()} |
          {error, any()} |
          disabled.

Status of the node, note that amoc_controller is disabled for the master node

last_user_id/0

-type last_user_id() :: non_neg_integer().

Highest user id registered in the node

running_status/0

-type running_status() ::
          #{scenario := amoc:scenario(),
            currently_running_users := user_count(),
            highest_user_id := last_user_id()}.

Details about the scenario currently running

user_count/0

-type user_count() :: non_neg_integer().

Number of users currently running in the node

Functions

add_users(StartId, EndId)

-spec add_users(amoc_scenario:user_id(), amoc_scenario:user_id()) -> ok | {error, term()}.

disable(Scenario, Settings)

-spec disable(amoc:scenario(), amoc_config:settings()) -> ok | {error, term()}.

get_status()

-spec get_status() -> amoc_status().

propagate_config(Node, Config)

-spec propagate_config(node(), amoc_config:config()) -> ok.

remove_users(Count, ForceRemove)

-spec remove_users(user_count(), boolean()) -> {ok, user_count()}.

start_scenario(Scenario, Settings)

-spec start_scenario(amoc:scenario(), amoc_config:settings()) -> ok | {error, term()}.

stop_scenario()

-spec stop_scenario() -> ok | {error, term()}.

update_settings(Settings)

-spec update_settings(amoc_config:settings()) -> ok | {error, term()}.

wait_user_rate()

-spec wait_user_rate() -> boolean().