retort v2.1.0 Retort.Client

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

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

Types

client_module()
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
client_modules()
client_modules() :: [client_module, ...]

A (non-empty) list of client_module

context()
context() :: map

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

created_by_pid()
created_by_pid() :: %{optional(pid) => Retort.Client.Generic.resource}

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

destroyed_set()
destroyed_set() :: MapSet.t

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

factory()
factory() :: atom

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

overrides()
overrides() :: Keyword.t

Field value overrides of default valeus in factory

Functions

create_factory(map)
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

create_factory_once(map)
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.

destroy_all_once(destroyed_set, pid, timeout \\ 5000)
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

destroy_dag(destroyed_set, context, key, referencing_modules)
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)
destroy_dags(destroyed_set, context, modules)

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.

destroy_dags_setup(context, modules)
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.

purge(modules)
purge(client_modules) :: :ok

Purges the queue for all modules using a shared channel

purge(channel, modules)
purge(%AMQP.Channel{conn: term, pid: term}, client_modules) :: :ok

Purges the queue for all modules on channel

setup(context, modules)
setup(context, client_modules) :: map

Pipes setup(context) for each module in modules