retort v2.7.0 Retort.Client View Source

Functionality shared between all specific, non-generic Retort.Client.*

Link to this section Summary

Types

A module that implements one of the following callbacks

  • destroy_dag(destroyed_set, context) :: {:ok, destroyed_set} | Retort.Client.Generic.error
  • purge(%AMQP.Channel{})
  • setup(context) :: context

A (non-empty) list of client_module

A map as passed to ExUnit.Callbacks.setup/2

Maps client pids to the structs created with by those clients

Set of client pids where Retort.Client.Generic.destroy_all has already been called

The name of a factory in Factory for generating the fields for InterpreterServrerRPC.Client.Generic.create

Field value overrides of default valeus in factory

Functions

Calls Retort.Client.create with fields from factory with overrides and params to help with includes

Only calls Retort.Client.create if the pid is not a key in created_by_pid

Only calls IntepreterServer.Rpc.Client.Generic.destroy_all if the pid is not in destroyed_set

Destroys the Directed Acyclic Graph (DAG) by destroying the DAG for all referencing_modules before destroying all referenced resources with the pid assigned to key in context

Destroys the Directed Acyclic Graph (DAG) of each module in modules in order as long as the previous module’s destroy_dag(destroyed_set, context) returned {:ok, new_destroyed_set}; otherwise, returns the first error

Destroys the Directect Acyclic Graph (DAG) of each module in modules in order if destroy_dag: true is in context. Fails if there is an error from destroy_dags/3; otherwise, returns context, so it can be piped with other setup functions

Purges the queue for all modules using a shared channel

Purges the queue for all modules on channel

Pipes setup(context) for each module in modules

Link to this section Types

Link to this type client_module() View Source
client_module() :: module()

A module that implements one of the following callbacks

  • destroy_dag(destroyed_set, context) :: {:ok, destroyed_set} | Retort.Client.Generic.error
  • purge(%AMQP.Channel{})
  • setup(context) :: context
Link to this type client_modules() View Source
client_modules() :: [client_module(), ...]

A (non-empty) list of client_module

Link to this type context() View Source
context() :: map()

A map as passed to ExUnit.Callbacks.setup/2.

Link to this type created_by_pid() View Source
created_by_pid() :: %{optional(pid()) => Retort.Client.Generic.resource()}

Maps client pids to the structs created with by those clients.

Link to this type destroyed_set() View Source
destroyed_set() :: MapSet.t()

Set of client pids where Retort.Client.Generic.destroy_all has already been called

Link to this type factory() View Source
factory() :: atom()

The name of a factory in Factory for generating the fields for InterpreterServrerRPC.Client.Generic.create

Link to this type overrides() View Source
overrides() :: Keyword.t()

Field value overrides of default valeus in factory

Link to this section Functions

Link to this function create_factory(options) View Source
create_factory(%{:factory => factory(), :factory_module => module(), optional(:overrides) => list(), optional(:params) => map(), :pid => pid(), optional(:timeout) => timeout()}) ::
  {:ok, Retort.Client.Generic.resource()} |
  Retort.Client.Generic.error()

Calls Retort.Client.create with fields from factory with overrides and params to help with includes

Link to this function create_factory_once(options) View Source
create_factory_once(%{:created_by_pid => created_by_pid(), :factory => factory(), :factory_module => module(), optional(:overrides) => list(), optional(:params) => map(), :pid => pid(), optional(:timeout) => timeout()}) ::
  {:ok, created_by_pid()} |
  Retort.Client.Generic.error()

Only calls Retort.Client.create if the pid is not a key in created_by_pid.

Link to this function destroy_all_once(destroyed_set, pid, timeout \\ 5000) View Source
destroy_all_once(destroyed_set(), pid(), timeout()) ::
  {:ok, destroyed_set()} |
  Retort.Client.Generic.error()

Only calls IntepreterServer.Rpc.Client.Generic.destroy_all if the pid is not in destroyed_set

Link to this function destroy_dag(destroyed_set, context, key, referencing_modules) View Source
destroy_dag(destroyed_set(), context(), key :: atom(), referencing_modules :: client_modules()) ::
  {:ok, destroyed_set()} |
  Retort.Client.Generic.error()

Destroys the Directed Acyclic Graph (DAG) by destroying the DAG for all referencing_modules before destroying all referenced resources with the pid assigned to key in context

Parameters

  • destroyed_set - set of pids that have already had destroy_all_once/2 called on them.
  • context - Maps atom keys, like location_client_pid to the pid for that resource’s client
  • key - An atom that selects a pid from the context
  • referencing_modules - Modules that define destroy_dag(destroyed_dag, context)
Link to this function destroy_dags(destroyed_set, context, modules) View Source

Destroys the Directed Acyclic Graph (DAG) of each module in modules in order as long as the previous module’s destroy_dag(destroyed_set, context) returned {:ok, new_destroyed_set}; otherwise, returns the first error.

Link to this function destroy_dags_setup(context, modules) View Source
destroy_dags_setup(context(), client_modules()) ::
  context() |
  no_return()

Destroys the Directect Acyclic Graph (DAG) of each module in modules in order if destroy_dag: true is in context. Fails if there is an error from destroy_dags/3; otherwise, returns context, so it can be piped with other setup functions.

Purges the queue for all modules using a shared channel

Link to this function purge(channel, modules) View Source
purge(%AMQP.Channel{conn: term(), pid: term()}, client_modules()) :: :ok

Purges the queue for all modules on channel

Link to this function setup(context, modules) View Source
setup(context(), client_modules()) :: map()

Pipes setup(context) for each module in modules