Oi.Adapters (oi v0.6.3)

Copy Markdown

Ready-to-use orchid_adapters.

Pass these as orchid_adapters: [&Oi.Adapters.orchid_intervention/1] in Oi.execute/2 opts or Config.new/1.

Summary

Functions

Prepends Orchid.Hook.ApplyInterventions to :global_hooks_stack when :orchid_intervention is available at runtime.

Prepends both hooks when available, respecting the layering order

Prepends OrchidStratum.BypassHook to :global_hooks_stack and auto-initialises ETS-backed Meta/Blob stores in baggage when :orchid_stratum is available at runtime.

Prepends OrchidSymbiont.Hooks.Injector to :global_hooks_stack when :orchid_symbiont is available at runtime.

Functions

orchid_intervention(acc)

@spec orchid_intervention({Orchid.Recipe.t(), keyword()}) ::
  {Orchid.Recipe.t(), keyword()}

Prepends Orchid.Hook.ApplyInterventions to :global_hooks_stack when :orchid_intervention is available at runtime.

No-op otherwise.

orchid_intervention_and_stratum(acc, conf)

@spec orchid_intervention_and_stratum(
  {Orchid.Recipe.t(), keyword()},
  Oi.Dispatch.Config.t()
) :: {Orchid.Recipe.t(), keyword()}

Prepends both hooks when available, respecting the layering order:

OrchidIntervention => OrchidStratum => [exclipit hook stack] => Core

Includes auto-init of ETS-backed Meta/Blob stores (same as orchid_stratum/1).

Equivalent to orchid_adapters: [&orchid_stratum/1, &orchid_intervention/1] but in a single adapter call.

orchid_stratum(acc, conf)

@spec orchid_stratum(
  {Orchid.Recipe.t(), keyword()},
  Oi.Dispatch.Config.t()
) :: {Orchid.Recipe.t(), keyword()}

Prepends OrchidStratum.BypassHook to :global_hooks_stack and auto-initialises ETS-backed Meta/Blob stores in baggage when :orchid_stratum is available at runtime.

Storage auto-init

If :meta_store / :blob_store are already present in baggage they are left untouched (user-supplied adapters win). Otherwise ETS-backed defaults (MetaStorage.EtsAdapter / BlobStorage.EtsAdapter) are created and inserted.

No-op when orchid_stratum is not available.

orchid_symbiont(acc)

@spec orchid_symbiont({Orchid.Recipe.t(), keyword()}) ::
  {Orchid.Recipe.t(), keyword()}

Prepends OrchidSymbiont.Hooks.Injector to :global_hooks_stack when :orchid_symbiont is available at runtime.

No-op otherwise.

Use this when your graph contains symbiont steps that need model handler injection:

orchid_adapters: [&Oi.Adapters.orchid_symbiont/1]