OrchidSymbiont.Resolver (orchid_symbiont v0.2.7)

Copy Markdown View Source

Resolves symbiont names to running process handlers.

This module handles the on-demand starting of GenServer workers based on blueprints registered in the Catalog. It manages the lifecycle including TTL-based auto-shutdown and scope isolation.

Resolution Order

  1. Check if a process is already running (via Registry)
  2. Look up the blueprint in the scoped catalog (if scope_id provided)
  3. Fall back to global catalog (unless strict_mode is enabled)
  4. Start the worker via DynamicSupervisor

Strict Mode

When strict_mode: true is passed, the resolver will NOT fall back to the global catalog if the blueprint isn't found in the scoped catalog. This is useful for multi-tenant applications requiring strong isolation.

Summary

Functions

Returns true if the given reference points to a live process.

Resolves a symbiont name to a handler.

Functions

alive?(handler)

@spec alive?(OrchidSymbiont.Handler.t()) :: boolean()

Returns true if the given reference points to a live process.

resolve(scope_id \\ nil, name, opts \\ [])

@spec resolve(binary() | nil, term(), keyword()) ::
  {:ok, OrchidSymbiont.Handler.t()} | {:error, term()}

Resolves a symbiont name to a handler.

If the worker is already running, returns the existing handler. Otherwise, looks up the blueprint and starts the worker on-demand.

Options

  • :strict_mode - When true, disables catalog fallback to global. Returns error if blueprint not found in scoped catalog.