Kvasir AgentServer v0.0.1 Kvasir.AgentServer.NOOPAgent View Source
A NOOP agent.
Executes the command, but never executes.
Link to this section Summary
Functions
Checks whether a given agent instance is currently active.
Dynamically configure specific components.
The current amount of active agent instances.
Create a customized NOOP agent.
Dispatch a command.
Dispatch a command, raises on failure.
Inspect the current state of an agent instance.
List the IDs of the currently active agent instances.
Start and return the pid of an agent instance.
Forces an agent instance to sleep.
Get the agent instance process pid.
Link to this section Functions
Specs
Checks whether a given agent instance is currently active.
Examples
iex> alive?(<id>)
true
Specs
Dynamically configure specific components.
Examples
iex> config(:source, [])
{:ok, []}
Specs
count() :: non_neg_integer()
The current amount of active agent instances.
Examples
iex> count()
4
Create a customized NOOP agent.
Specs
dispatch(Kvasir.Command.t(), Keyword.t()) :: {:ok, Kvasir.Command.t()} | {:error, atom()}
Dispatch a command.
Specs
dispatch!(Kvasir.Command.t(), Keyword.t()) :: Kvasir.Command.t() | no_return()
Dispatch a command, raises on failure.
Examples
iex> dispatch!(<cmd>, instance: <id>)
<cmd>
Specs
Inspect the current state of an agent instance.
The agent is opened based on the given id.
Examples
iex> inspect(<id>)
{:ok, <state>}
Specs
list() :: [term()]
List the IDs of the currently active agent instances.
Examples
iex> list()
[<id>, <id>]
Specs
Start and return the pid of an agent instance.
Examples
iex> open(<id>)
{:ok, #PID<0.109.0>}
Specs
Forces an agent instance to sleep.
(Shuts down the process.)
Examples
iex> sleep(<id>)
:ok
Optionally allows to pass a reason for sleep:
iex> sleep(<id>, :testing)
:ok
Specs
Get the agent instance process pid.
Examples
iex> whereis(<id>)
<pid>