Kvasir AgentServer v0.0.2 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

alive?(any()) :: boolean()

Checks whether a given agent instance is currently active.

Examples

iex> alive?(<id>)
true

Specs

config(component :: atom(), opts :: Keyword.t()) :: Keyword.t()

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
Link to this function

customized(name, opts \\ [])

View Source

Create a customized NOOP agent.

Link to this function

dispatch(command, opts \\ [])

View Source

Specs

dispatch(Kvasir.Command.t(), Keyword.t()) ::
  {:ok, Kvasir.Command.t()} | {:error, atom()}

Dispatch a command.

Link to this function

dispatch!(command, opts \\ [])

View Source

Specs

Dispatch a command, raises on failure.

Examples

iex> dispatch!(<cmd>, instance: <id>)
<cmd>

Specs

inspect(any()) :: {:ok, term()} | {:error, atom()}

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

open(any()) :: {:ok, pid()} | {:error, atom()}

Start and return the pid of an agent instance.

Examples

iex> open(<id>)
{:ok, #PID<0.109.0>}
Link to this function

sleep(id, reason \\ :sleep)

View Source

Specs

sleep(id :: any(), reason :: atom()) :: :ok

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

whereis(any()) :: pid() | nil

Get the agent instance process pid.

Examples

iex> whereis(<id>)
<pid>