View Source amoc_scenario behaviour (amoc v4.0.0)
Wrapper around the defined scenario
Summary
Callbacks
Functions
Applies the Scenario:init/0
callback
Applies the Scenario:start/1,2
callback
Applies the Scenario:terminate/0,1
callback
Types
-type state() :: term().
The state of the scenario as returned by init/0
-type user_id() :: pos_integer().
Unique integer ID of every actor spawned
Callbacks
-callback terminate() -> any().
Functions
-spec init(amoc:scenario()) -> {ok, state()} | {error, Reason :: term()}.
Applies the Scenario:init/0
callback
Runs on the controller process and spans a [amoc, scenario, init, _]
telemetry event.
-spec start(amoc:scenario(), user_id(), state()) -> term().
Applies the Scenario:start/1,2
callback
Either Scenario:start/1
or Scenario:start/2
must be exported from the behaviour module. if scenario module exports both functions, Scenario:start/2
is used.
Runs on the user process and spans a [amoc, scenario, user, _]
telemetry event.
-spec terminate(amoc:scenario(), state()) -> ok | {ok, any()} | {error, Reason :: term()}.
Applies the Scenario:terminate/0,1
callback
Scenario:terminate/0
and Scenario:terminate/1
callbacks are optional. If the scenario module exports both functions, Scenario:terminate/1
is used.
Runs on the controller process and spans a [amoc, scenario, terminate, _]
telemetry event.