amoc_controller (amoc v4.2.0)
View SourceMain 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
-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
-type last_user_id() :: non_neg_integer().
Highest user id registered in the node
-type running_status() :: #{scenario := amoc:scenario(), currently_running_users := user_count(), highest_user_id := last_user_id()}.
Details about the scenario currently running
-type user_count() :: non_neg_integer().
Number of users currently running in the node
Functions
-spec add_users(amoc_scenario:user_id(), amoc_scenario:user_id()) -> ok | {error, term()}.
-spec disable(amoc:scenario(), amoc_config:settings()) -> ok | {error, term()}.
-spec get_status() -> amoc_status().
-spec propagate_config(node(), amoc_config:config()) -> ok.
-spec remove_users(user_count(), boolean()) -> {ok, user_count()}.
-spec start_scenario(amoc:scenario(), amoc_config:settings()) -> ok | {error, term()}.
-spec stop_scenario() -> ok | {error, term()}.
-spec update_settings(amoc_config:settings()) -> ok | {error, term()}.
-spec wait_user_rate() -> boolean().