Spex.InstanceManager.SimpleInstanceManager (spex v0.1.2)

Copy Markdown View Source

Single-node instance manager backed by one Spex.InstanceManager.Server process.

Use this manager when you want all instance operations handled by a single GenServer and a single DETS table.

See Spex for info on using this instance manager.

Configuration

SimpleInstanceManager forwards server options to Spex.InstanceManager.Server (see Spex.InstanceManager.Server.server_opt()), with one internal detail:

Supported options (see Spex):

  • :impl_models_dir (String.t()) Path to .spex implementation model files loaded on startup. Default: value from config or else "./spex_impl_models".

  • :dets_dir (String.t()) Directory where the DETS file for this manager is stored. Default: value from config or else "./spex_dets".

  • :check_transition_timeouts_on_start? (boolean()) When true, existing instances in DETS are checked during startup and transition timeout errors are emitted if needed. Default: true.

  • :prune_interval (timeout()) Interval for periodic pruning checks. Use :infinity to disable periodic checks after startup. Default: %Duration{hour: 6} |> to_timeout().

Pruning semantics:

  • one prune pass is always executed immediately on startup,
  • when :prune_interval != :infinity, additional periodic prune passes are scheduled,
  • when :prune_interval == :infinity, no periodic passes are scheduled after the initial startup pass.

Option resolution order

For each server option, effective value is resolved in this order:

  1. option passed to start_link/1 / supervisor child spec,
  2. application environment key under :spex,
  3. the default value.

Summary

Functions

Functions

all_impl_models()

Callback implementation for Spex.InstanceManager.all_impl_models/0.

all_instances()

Callback implementation for Spex.InstanceManager.all_instances/0.

all_instances(specification)

Callback implementation for Spex.InstanceManager.all_instances/1.

child_spec(opts)

Callback implementation for Spex.InstanceManager.child_spec/1.

delete_instance(instance_identifier)

Callback implementation for Spex.InstanceManager.delete_instance/1.

delete_instances(filter_fun)

Callback implementation for Spex.InstanceManager.delete_instances/1.

export_impl_models()

Callback implementation for Spex.InstanceManager.export_impl_models/0.

get_instance(instance_identifier)

Callback implementation for Spex.InstanceManager.get_instance/1.

init_instance(spec, instance_identifier, meta \\ nil, initial_state \\ nil)

Callback implementation for Spex.InstanceManager.init_instance/4.

init_instance!(spec, instance_identifier, meta \\ nil, initial_state \\ nil)

Callback implementation for Spex.InstanceManager.init_instance!/4.

init_instance_async(spec, instance_identifier, meta \\ nil, initial_state \\ nil)

Callback implementation for Spex.InstanceManager.init_instance_async/4.

mock_instance!(spec, instance_identifier, state, meta \\ nil)

Callback implementation for Spex.InstanceManager.mock_instance!/4.

start_link(opts)

Callback implementation for Spex.InstanceManager.start_link/1.

transition(instance_identifier, action, state)

Callback implementation for Spex.InstanceManager.transition/3.

transition!(instance_identifier, action, state)

Callback implementation for Spex.InstanceManager.transition!/3.

transition_async(instance_identifier, action, state)

Callback implementation for Spex.InstanceManager.transition_async/3.