Jido.Signal.Names (Jido Signal v2.2.1)

View Source

Resolves process names based on optional jido: instance scoping.

When jido: option is present, routes all operations through instance-scoped supervisors. When absent, uses global defaults for zero-config operation.

Instance Isolation

The jido: option enables complete isolation between instances:

  • Each instance has its own Registry, TaskSupervisor, and Bus processes
  • No cross-instance signal leakage
  • Easy to test isolation guarantees

Examples

# Global (default) - uses Jido.Signal.Registry
Names.registry([])
#=> Jido.Signal.Registry

# Instance-scoped - uses MyApp.Jido.Signal.Registry
Names.registry(jido: MyApp.Jido)
#=> MyApp.Jido.Signal.Registry

Summary

Functions

Returns the Extension Registry name for the given instance scope.

Extracts the jido instance from options, returning nil if not present.

Returns the Registry name for the given instance scope.

Resolves a module name based on instance scope.

Returns the Supervisor name for the given instance scope.

Returns the TaskSupervisor name for the given instance scope.

Types

opts()

@type opts() :: keyword()

Functions

ext_registry(opts)

@spec ext_registry(opts()) :: atom()

Returns the Extension Registry name for the given instance scope.

Examples

iex> Jido.Signal.Names.ext_registry([])
Jido.Signal.Ext.Registry

iex> Jido.Signal.Names.ext_registry(jido: MyApp.Jido)
MyApp.Jido.Signal.Ext.Registry

instance(opts)

@spec instance(opts()) :: atom() | nil

Extracts the jido instance from options, returning nil if not present.

registry(opts)

@spec registry(opts()) :: atom()

Returns the Registry name for the given instance scope.

Examples

iex> Jido.Signal.Names.registry([])
Jido.Signal.Registry

iex> Jido.Signal.Names.registry(jido: MyApp.Jido)
MyApp.Jido.Signal.Registry

scoped(opts, default)

@spec scoped(opts(), module()) :: atom()

Resolves a module name based on instance scope.

When jido: option is nil or not present, returns the default module. When jido: option is present, concatenates the instance with the default module's relative path under Jido.Signal.

Examples

iex> Jido.Signal.Names.scoped([], Jido.Signal.Registry)
Jido.Signal.Registry

iex> Jido.Signal.Names.scoped([jido: MyApp.Jido], Jido.Signal.Registry)
MyApp.Jido.Signal.Registry

supervisor(opts)

@spec supervisor(opts()) :: atom()

Returns the Supervisor name for the given instance scope.

Examples

iex> Jido.Signal.Names.supervisor([])
Jido.Signal.Supervisor

iex> Jido.Signal.Names.supervisor(jido: MyApp.Jido)
MyApp.Jido.Signal.Supervisor

task_supervisor(opts)

@spec task_supervisor(opts()) :: atom()

Returns the TaskSupervisor name for the given instance scope.

Examples

iex> Jido.Signal.Names.task_supervisor([])
Jido.Signal.TaskSupervisor

iex> Jido.Signal.Names.task_supervisor(jido: MyApp.Jido)
MyApp.Jido.Signal.TaskSupervisor