Composition root: select discovered MountSpecs through declarative plug layers (build.edn / iaddon.edn), then order + mount them.
Joins the two pure engines by :addon/id — hive-addon.plug (SELECT, keyed by lib-sym) and hive-addon.mount (ORDER + EXECUTE, keyed by :addon/id). Per-addon plug :config overrides merge on top of the injected base config resolver. With no plug layers (or none carrying :iaddon/plugs) every discovered spec is kept — behaviourally identical to mount/mount-classpath!.
Composition root: select discovered MountSpecs through declarative plug layers (build.edn / iaddon.edn), then order + mount them. Joins the two pure engines by :addon/id — hive-addon.plug (SELECT, keyed by lib-sym) and hive-addon.mount (ORDER + EXECUTE, keyed by :addon/id). Per-addon plug :config overrides merge on top of the injected base config resolver. With no plug layers (or none carrying :iaddon/plugs) every discovered spec is kept — behaviourally identical to mount/mount-classpath!.
(compose! discovered-specs layers host)(compose! discovered-specs
layers
host
{:keys [resolve-config]
:or {resolve-config port/resolve-config-default}
:as opts})Full composition: compose-plan then mount! the plan into host, threading per-addon build.edn :config over the base resolve-config. opts: {:profile :rules :fail-closed-cycles :strict-select :resolve-config (base, default port/resolve-config-default)}. Returns (r/ok {<compose-plan keys> :report MountReport}) or the (r/err ...) from compose-plan. Mount failures are recorded in :report (graceful degrade).
Full composition: compose-plan then mount! the plan into host, threading
per-addon build.edn :config over the base resolve-config. opts:
{:profile :rules :fail-closed-cycles :strict-select
:resolve-config (base, default port/resolve-config-default)}. Returns
(r/ok {<compose-plan keys> :report MountReport}) or the (r/err ...) from
compose-plan. Mount failures are recorded in :report (graceful degrade).(compose-classpath! host)(compose-classpath! host {:keys [layer-paths] :as opts})One-call host entry: discover MountSpecs on the classpath + read plug layers from :layer-paths + compose! into host. Returns (r/ok {<compose! keys> :discovery-errors [..] :layer-errors [..]}) or the (r/err ...) from compose!. :layer-paths defaults to [] ⇒ mount every discovered spec (≡ mount-classpath!). opts also threads :profile :rules :fail-closed-cycles :strict-select :resolve-config.
One-call host entry: discover MountSpecs on the classpath + read plug layers
from :layer-paths + compose! into host. Returns (r/ok {<compose! keys>
:discovery-errors [..] :layer-errors [..]}) or the (r/err ...) from compose!.
:layer-paths defaults to [] ⇒ mount every discovered spec (≡ mount-classpath!).
opts also threads :profile :rules :fail-closed-cycles :strict-select
:resolve-config.(compose-config-resolver config-by-id)(compose-config-resolver base-resolver config-by-id)Wrap base-resolver so per-addon build.edn :config overrides merge ON TOP of the base (e.g. hive-di) config. base-resolver defaults to port/resolve-config-default. Returns (fn [spec] -> config-map).
Wrap base-resolver so per-addon build.edn :config overrides merge ON TOP of the base (e.g. hive-di) config. base-resolver defaults to port/resolve-config-default. Returns (fn [spec] -> config-map).
(compose-plan discovered-specs layers)(compose-plan discovered-specs layers {:keys [profile strict-select] :as opts})Pure composition (no mount effects): select discovered specs through the plug layers, then solve the mount order. Returns (r/ok {:selected-ids #{addon-id} :dropped {addon-id reason} :unjoinable [lib] :selected-absent #{addon-id} :config-by-id {addon-id config} :plan MountPlan}) or the (r/err ...) from plug resolution / a fail-closed solve. When no layer carries :iaddon/plugs every discovered spec is kept (back-compat).
Pure composition (no mount effects): select discovered specs through the plug
layers, then solve the mount order. Returns
(r/ok {:selected-ids #{addon-id} :dropped {addon-id reason} :unjoinable [lib]
:selected-absent #{addon-id} :config-by-id {addon-id config} :plan MountPlan})
or the (r/err ...) from plug resolution / a fail-closed solve. When no layer
carries :iaddon/plugs every discovered spec is kept (back-compat).(plug-index {:keys [config selected dropped]})Index a plug resolution (the unwrapped :ok of plug/resolve-config, i.e. {:config :selected :dropped :provenance}) by :addon/id. Returns {:by-id {addon-id plug} :selected-ids #{addon-id} :dropped-ids #{addon-id} :dropped-reasons {addon-id reason} :config-by-id {addon-id config} :unjoinable [lib-sym]}. A plug lacking :addon/id cannot bind to a MountSpec → its lib-sym is collected in :unjoinable, never thrown.
Index a plug resolution (the unwrapped :ok of plug/resolve-config, i.e.
{:config :selected :dropped :provenance}) by :addon/id. Returns
{:by-id {addon-id plug} :selected-ids #{addon-id} :dropped-ids #{addon-id}
:dropped-reasons {addon-id reason} :config-by-id {addon-id config}
:unjoinable [lib-sym]}. A plug lacking :addon/id cannot bind to a MountSpec →
its lib-sym is collected in :unjoinable, never thrown.(read-layers paths)(read-layers paths classloader)Read ordered layer paths (lowest precedence first) into plug layers. Returns {:layers [{:id path :config IaddonConfig}] :errors [{:path :error}]}. A missing path is SKIPPED (not an error); a malformed/invalid one → :errors. Never throws.
Read ordered layer paths (lowest precedence first) into plug layers. Returns
{:layers [{:id path :config IaddonConfig}] :errors [{:path :error}]}. A
missing path is SKIPPED (not an error); a malformed/invalid one → :errors.
Never throws.(select-specs discovered-specs
{:keys [dropped-ids selected-ids dropped-reasons config-by-id
unjoinable]}
{:keys [strict-select]})Filter discovered MountSpecs through a plug index. Default (strict-select false): plug only REMOVES — keep every spec whose :addon/id is NOT in :dropped-ids UNLESS it is also in :selected-ids (a selected sibling lib wins over a dropped one sharing the addon-id); a spec with no plug entry is kept. Strict (strict-select true): keep only specs whose :addon/id ∈ :selected-ids. Returns {:specs [MountSpec] :dropped {addon-id reason} :unjoinable [lib-sym] :selected-absent #{addon-id} :config-by-id {addon-id config}}. :selected-absent are plug-selected ids with no discovered spec (reported, not an error).
Filter discovered MountSpecs through a plug index.
Default (strict-select false): plug only REMOVES — keep every spec whose
:addon/id is NOT in :dropped-ids UNLESS it is also in :selected-ids (a
selected sibling lib wins over a dropped one sharing the addon-id); a spec
with no plug entry is kept.
Strict (strict-select true): keep only specs whose :addon/id ∈ :selected-ids.
Returns {:specs [MountSpec] :dropped {addon-id reason} :unjoinable [lib-sym]
:selected-absent #{addon-id} :config-by-id {addon-id config}}. :selected-absent
are plug-selected ids with no discovered spec (reported, not an error).cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |