Effectful boundary for client runtimes: runs the plans built by hive-addon.runtime.plan and provisions an injected addon's runtimes.
Effects go through two injected ports: IRuntimeFs for files and an eval-fn
(fn [client commands]) for clients that are already running. local-fs is
the production filesystem; recording-fs records effects for tests and can
fail on demand. run-plan! never throws: it stops at the first failing
effect and reports the rest as skipped.
provisioner is the composition a host passes to hive-addon.mount/mount!
as :provision, and to teardown! as :deprovision.
Rationale lives in hive memory (KG-linked), not here.
Effectful boundary for client runtimes: runs the plans built by hive-addon.runtime.plan and provisions an injected addon's runtimes. Effects go through two injected ports: IRuntimeFs for files and an eval-fn (fn [client commands]) for clients that are already running. `local-fs` is the production filesystem; `recording-fs` records effects for tests and can fail on demand. `run-plan!` never throws: it stops at the first failing effect and reports the rest as skipped. `provisioner` is the composition a host passes to hive-addon.mount/mount! as :provision, and to teardown! as :deprovision. Rationale lives in hive memory (KG-linked), not here.
(declarations spec extra)The runtimes to provision for SPEC: its own :addon/runtime followed by any a host supplies in EXTRA, a map of addon id to RuntimeDecls.
The runtimes to provision for SPEC: its own :addon/runtime followed by any a host supplies in EXTRA, a map of addon id to RuntimeDecls.
(copy-tree! fs from to)Copy the directory FROM to TO, creating TO.
Copy the directory FROM to TO, creating TO.
(delete-tree! fs path)Remove PATH and everything under it; absent is fine.
Remove PATH and everything under it; absent is fine.
(write-file! fs path content)Write CONTENT to PATH atomically, creating parents.
Write CONTENT to PATH atomically, creating parents.
(provision-runtime! {:keys [fs eval-fn profiles home live?] :as opts}
instance
decl)Install DECL for INSTANCE and, when :live? and an :eval-fn are given, activate it in running clients. Returns a RuntimeReport. Never throws.
opts: {:fs :eval-fn :profiles :home :live?}. Live activation failing does not fail the install: it is reported under :live-ok?.
Install DECL for INSTANCE and, when :live? and an :eval-fn are given,
activate it in running clients. Returns a RuntimeReport. Never throws.
opts: {:fs :eval-fn :profiles :home :live?}. Live activation failing does
not fail the install: it is reported under :live-ok?.(provisioner {:keys [declarations home] :as opts})A host's provisioning seam for hive-addon.mount: {:provision (fn [spec instance]) :deprovision (fn [addon-id]) :installed (fn [])}.
:provision returns a ProvisionReport, or nil when SPEC declares no runtime and the host supplies none. What was installed is remembered per addon id, so :deprovision removes exactly that.
opts: {:fs IRuntimeFs (default local-fs), :eval-fn (fn [client commands]), :profiles (default plan/default-profiles), :home (required), :declarations {addon-id RuntimeDecls}, :live? (default true)}
A host's provisioning seam for hive-addon.mount: {:provision (fn [spec
instance]) :deprovision (fn [addon-id]) :installed (fn [])}.
:provision returns a ProvisionReport, or nil when SPEC declares no runtime
and the host supplies none. What was installed is remembered per addon id,
so :deprovision removes exactly that.
opts: {:fs IRuntimeFs (default local-fs), :eval-fn (fn [client commands]),
:profiles (default plan/default-profiles), :home (required),
:declarations {addon-id RuntimeDecls}, :live? (default true)}(recording-fs)(recording-fs fail-on)A filesystem that records every effect in (:log fs) and throws on the effect kinds in FAIL-ON.
A filesystem that records every effect in (:log fs) and throws on the effect kinds in FAIL-ON.
Perform one Effect with the ports in CTX ({:fs IRuntimeFs :eval-fn f}).
Perform one Effect with the ports in CTX ({:fs IRuntimeFs :eval-fn f}).
(run-plan! ctx plan)Run PLAN's effects in order. Returns a vector of Outcome, one per effect; after the first failure the remaining effects are not run and are reported :skipped?. Never throws.
Run PLAN's effects in order. Returns a vector of Outcome, one per effect; after the first failure the remaining effects are not run and are reported :skipped?. Never throws.
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 |