Liking cljdoc? Tell your friends :D

hive-compose.pipeline.ops

Section and profile operations over a context:

{:engine IComposeEngine :runner IProgramRunner ; optional: host programs :settings Settings :state (atom {:active {id Active} :current id-or-nil}) :now (fn [] epoch-ms) :save! (fn [persisted-state] Result)} ; optional

A subject is a Profile: a configured preset (lookup) or a section resolved from a target against the configured compose projects (resolve-target). Every operation answers a Result (reap! and adopt! answer reports). The active map changes only after the engine confirmed the action.

A section also holds the host programs paired with its services: they start once its containers are up and stop when the last section holding them is released. A program that fails to start is reported, never fatal.

Section and profile operations over a context:

  {:engine   IComposeEngine
   :runner   IProgramRunner                   ; optional: host programs
   :settings Settings
   :state    (atom {:active {id Active} :current id-or-nil})
   :now      (fn [] epoch-ms)
   :save!    (fn [persisted-state] Result)}   ; optional

A subject is a Profile: a configured preset (`lookup`) or a section resolved
from a target against the configured compose projects (`resolve-target`).
Every operation answers a Result (reap! and adopt! answer reports). The
active map changes only after the engine confirmed the action.

A section also holds the host programs paired with its services: they start
once its containers are up and stop when the last section holding them is
released. A program that fails to start is reported, never fatal.
raw docstring

adopt!clj

(adopt! ctx)

Take charge, with a fresh idle clock, of what runs without an owner: configured presets that are running, and the running services of configured compose projects that no active profile accounts for (as section <project>/adopted, needing their depends_on closure). Configured projects that share one compose project adopt each stray once, in id order. Answers the adopted ids.

Take charge, with a fresh idle clock, of what runs without an owner:
configured presets that are running, and the running services of configured
compose projects that no active profile accounts for (as section
`<project>/adopted`, needing their depends_on closure). Configured projects
that share one compose project adopt each stray once, in id order. Answers
the adopted ids.
sourceraw docstring

down!clj

(down! ctx id action)
source

down-profile!clj

(down-profile! ctx p action)

Take p down with action (:down removes containers, :stop keeps them; volumes are never touched). Services and programs another active profile needs stay up.

Take `p` down with `action` (:down removes containers, :stop keeps them;
volumes are never touched). Services and programs another active profile
needs stay up.
sourceraw docstring

logsclj

(logs ctx id tail)
source

logs-profileclj

(logs-profile ctx p tail)

Result<{:out}>: the last tail log lines of p; touches it when active.

Result<{:out}>: the last `tail` log lines of `p`; touches it when active.
sourceraw docstring

lookupclj

(lookup ctx id)

Result<Profile> for id: the configured preset, else the snapshot an active entry (a preset or a section) ran with.

Result<Profile> for `id`: the configured preset, else the snapshot an active
entry (a preset or a section) ran with.
sourceraw docstring

merge-adoptedclj

(merge-adopted old e)

Active entry old with the newly adopted strays of entry e folded in; e itself when there is no old. Pure.

The :profile snapshot's :profile/services follows the merged :services: logs and ps address a section through that snapshot, so a stale one would keep naming the subset adopted first. An entry without :needs needs exactly its :services, so a merged :needs starts from whichever of the two old carries.

Active entry `old` with the newly adopted strays of entry `e` folded in;
`e` itself when there is no `old`. Pure.

The `:profile` snapshot's `:profile/services` follows the merged
`:services`: logs and ps address a section through that snapshot, so a
stale one would keep naming the subset adopted first. An entry without
`:needs` needs exactly its `:services`, so a merged `:needs` starts from
whichever of the two `old` carries.
sourceraw docstring

programsclj

(programs ctx)

Result<[row]>: every program the configured projects declare, as it would start (kind, command, nREPL port, the services it is paired with) and, when it runs, its pid and whether its nREPL answers.

Result<[row]>: every program the configured projects declare, as it would
start (kind, command, nREPL port, the services it is paired with) and, when
it runs, its pid and whether its nREPL answers.
sourceraw docstring

projectsclj

(projects ctx)

Result<[project]>: every compose project on the host, managed ones marked.

Result<[project]>: every compose project on the host, managed ones marked.
sourceraw docstring

psclj

(ps ctx id)
source

ps-profileclj

(ps-profile ctx p)

Result<{:profile :needs :running}> for p; touches it when active.

Result<{:profile :needs :running}> for `p`; touches it when active.
sourceraw docstring

reap!clj

(reap! ctx)

One reaper pass: reconcile, then release every idle profile.

One reaper pass: reconcile, then release every idle profile.
sourceraw docstring

reconcile!clj

(reconcile! ctx)

Forget active profiles none of whose services still run (taken down outside the addon), stopping the programs they alone hold. Answers the forgotten ids.

Forget active profiles none of whose services still run (taken down outside
the addon), stopping the programs they alone hold. Answers the forgotten ids.
sourceraw docstring

resolve-targetclj

(resolve-target ctx target-str)

Result<Profile>: the section running exactly what target-str names (services or native compose profiles, see promote.target/parse), in the first configured project that defines all of them. Its services close over the compose file's depends_on when brought up.

Result<Profile>: the section running exactly what `target-str` names
(services or native compose profiles, see `promote.target/parse`), in the
first configured project that defines all of them. Its services close over
the compose file's depends_on when brought up.
sourceraw docstring

statusclj

(status ctx)

Every configured preset and every active section, with activity, reaper countdown and the host programs it holds.

Every configured preset and every active section, with activity, reaper
countdown and the host programs it holds.
sourceraw docstring

subjectclj

(subject ctx {:keys [target id]})

Result<Profile> for a tool call: target resolves a section, else id looks up a preset or an active section. A target is resolved against the config as it is now, so an active section picks up what its project gained since (a program, a TTL); the snapshot it ran with answers only when the target no longer resolves.

Result<Profile> for a tool call: `target` resolves a section, else `id`
looks up a preset or an active section. A target is resolved against the
config as it is now, so an active section picks up what its project gained
since (a program, a TTL); the snapshot it ran with answers only when the
target no longer resolves.
sourceraw docstring

switch!clj

(switch! ctx id)
source

switch-profile!clj

(switch-profile! ctx p)

Make p current: release what only the previous current profile needs, then bring p up. Shared services and the programs p wants stay up throughout.

Make `p` current: release what only the previous current profile needs, then
bring `p` up. Shared services and the programs `p` wants stay up throughout.
sourceraw docstring

targetsclj

(targets ctx)

Result<[{:project :services :profiles}]>: what can be named as a target in each configured compose project.

Result<[{:project :services :profiles}]>: what can be named as a target in each
configured compose project.
sourceraw docstring

touch!clj

(touch! ctx id)

Reset the idle clock of active profile id.

Reset the idle clock of active profile `id`.
sourceraw docstring

touch-all!clj

(touch-all! ctx project)

Reset the idle clock of every active profile, or only those of compose project project (the configured project id is accepted too).

Reset the idle clock of every active profile, or only those of compose
project `project` (the configured project id is accepted too).
sourceraw docstring

up!clj

(up! ctx id)
source

up-profile!clj

(up-profile! ctx p)

Bring p up alongside whatever is active. Becomes current when nothing is.

Bring `p` up alongside whatever is active. Becomes current when nothing is.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close