OrchidSymbiont.Catalog (orchid_symbiont v0.2.7)

Copy Markdown View Source

A blueprint registry for symbiont workers.

Stores the module and startup arguments (blueprint) for each named symbiont. Acts as a lookup table that the Resolver uses to start workers on-demand.

Scope Support

Can be started globally or per-scope. When started with a scope_id, the catalog is isolated to that scope and won't conflict with others.

Global Fallback

Scoped catalogs will fall back to the global catalog if a blueprint is not found locally, allowing DRY registration patterns.

Summary

Functions

Returns a specification to start this module under a supervisor.

Dumps all blueprints from the catalog.

Looks up a blueprint by key.

Registers a blueprint for a given key.

Restores the catalog state from a previously dumped map.

Starts the catalog agent.

Functions

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

dump(name \\ __MODULE__)

@spec dump(atom()) :: map()

Dumps all blueprints from the catalog.

lookup(name \\ __MODULE__, key)

@spec lookup(atom(), term()) :: {:ok, term()} | :not_found

Looks up a blueprint by key.

Returns {:ok, value} if found, or :not_found if the key doesn't exist in the catalog.

register(name \\ __MODULE__, key, value)

@spec register(atom(), term(), term()) :: :ok

Registers a blueprint for a given key.

The value is typically a tuple {module, args} describing how to start the worker.

restore(name \\ __MODULE__, data)

@spec restore(atom(), map()) :: :ok

Restores the catalog state from a previously dumped map.

start_link(opts)

@spec start_link(keyword()) :: Agent.on_start()

Starts the catalog agent.

If scope_id is provided, creates an isolated catalog for that scope. Otherwise, starts the global catalog.