Liking cljdoc? Tell your friends :D

hive-compose.adapter.cli

IComposeEngine over the docker compose CLI. Argv construction and output parsing are pure; the process runs through an injected exec with hive-system's shell.core/exec! contract (argv, opts) -> Result.

Secret references in a profile's env are read only by the calls that create containers (up, a recreating restart), through the injected resolver (see hive-compose.adapter.secrets). Every other call is given their renderings, so it interpolates and reads no store.

IComposeEngine over the docker compose CLI. Argv construction and output
parsing are pure; the process runs through an injected `exec` with
hive-system's `shell.core/exec!` contract (argv, opts) -> Result.

Secret references in a profile's env are read only by the calls that create
containers (`up`, a recreating `restart`), through the injected resolver
(see `hive-compose.adapter.secrets`). Every other call is given their
renderings, so it interpolates and reads no store.
raw docstring

hive-compose.adapter.exec

hc-9 data commands at the boundary: port/IDataExec on the docker CLI engine (docker exec into a running container of a stack instance) and port/ICommandRunner on the host runner (a host command run to completion). Both extend the existing records, so their constructors and namespaces stay as they are; requiring this ns is what extends them.

Secret references in a command's env are read at spawn through the record's resolver and passed in the process environment only: docker exec gets -e VAR by NAME, so no value is ever in an argv, and what the process prints is scrubbed of resolved values.

hc-9 data commands at the boundary: `port/IDataExec` on the docker CLI
engine (`docker exec` into a running container of a stack instance) and
`port/ICommandRunner` on the host runner (a host command run to
completion). Both extend the existing records, so their constructors and
namespaces stay as they are; requiring this ns is what extends them.

Secret references in a command's env are read at spawn through the
record's resolver and passed in the process environment only: `docker
exec` gets `-e VAR` by NAME, so no value is ever in an argv, and what the
process prints is scrubbed of resolved values.
raw docstring

hive-compose.adapter.host

IProgramRunner over the host: processes through hive-system (process.core spawns, process.liveness answers for a pid, shell.core/exec! signals), build files through EDN reads.

A program starts as sh -c 'exec setsid <command> >> <log> 2>&1': the shell replaces itself with the program in a session of its own, so the spawned pid is the program's and its process group's. The group is what -stop! signals, which reaches the JVMs and node processes a watch forks. The pid is all that is kept, so a program outlives the addon and is stopped by pid after a restart.

Secret references in :program/env are read at -start! through the injected resolver (see hive-compose.adapter.secrets) and handed to the process only; nothing kept about a program carries them.

IProgramRunner over the host: processes through hive-system (`process.core`
spawns, `process.liveness` answers for a pid, `shell.core/exec!` signals),
build files through EDN reads.

A program starts as `sh -c 'exec setsid <command> >> <log> 2>&1'`: the shell
replaces itself with the program in a session of its own, so the spawned pid
is the program's and its process group's. The group is what `-stop!`
signals, which reaches the JVMs and node processes a watch forks. The pid is
all that is kept, so a program outlives the addon and is stopped by pid after
a restart.

Secret references in `:program/env` are read at `-start!` through the
injected resolver (see `hive-compose.adapter.secrets`) and handed to the
process only; nothing kept about a program carries them.
raw docstring

hive-compose.adapter.http

Boundary: the control API served by the JDK's com.sun.net.httpserver (no extra dependency). Bound to a loopback address only. The handler is (fn [req] -> {:status :headers :body}), req being {:method :path :headers :body}: :headers lower-cased names to their first value, :body the request text or nil when it is over max-body-bytes (see hive-compose.api/route).

Boundary: the control API served by the JDK's com.sun.net.httpserver (no
extra dependency). Bound to a loopback address only. The handler is
`(fn [req] -> {:status :headers :body})`, req being {:method :path :headers
:body}: :headers lower-cased names to their first value, :body the request
text or nil when it is over `max-body-bytes` (see `hive-compose.api/route`).
raw docstring

hive-compose.adapter.meminfo

IHostMemory over Linux /proc/meminfo (hc-16a). The parse is pure (hive-compose.promote.resources/parse-meminfo); this is only the read.

IHostMemory over Linux /proc/meminfo (hc-16a). The parse is pure
(`hive-compose.promote.resources/parse-meminfo`); this is only the read.
raw docstring

hive-compose.adapter.procfs

IProcessTable over Linux /proc: the boundary that turns the host's process table into the Snapshot hive-compose.promote.orphan reads. Only the processes that can be orphaned container processes (parent systemd --user, subuid range or a container cgroup) have their mounts and listening sockets read; a process that is gone or unreadable mid-walk is left out, never an error.

IProcessTable over Linux /proc: the boundary that turns the host's process
table into the Snapshot `hive-compose.promote.orphan` reads. Only the
processes that can be orphaned container processes (parent `systemd
--user`, subuid range or a container cgroup) have their mounts and
listening sockets read; a process that is gone or unreadable mid-walk is
left out, never an error.
raw docstring

hive-compose.adapter.procnet

IActivity over Linux /proc/net/tcp and /proc/net/tcp6: the remote endpoints of the connections accepted on a local port. Parsing is pure; reading the two files is the only effect, and a file that cannot be read contributes nothing (another OS answers no peers, never an error).

IActivity over Linux /proc/net/tcp and /proc/net/tcp6: the remote
endpoints of the connections accepted on a local port. Parsing is pure;
reading the two files is the only effect, and a file that cannot be read
contributes nothing (another OS answers no peers, never an error).
raw docstring

hive-compose.adapter.secrets

Secret references read from their stores at spawn. The port is hive-system's ISecretBackend; a resolver is {scheme backend}, one backend per scheme a reference may name. :pass is hive-system's PassBackend: pass <path> through the injected exec, its first non-blank line, trimmed.

A failure names the variable, the reference and the store's reason, never a value. A new scheme ({:env "VAR"}) is a backend of that id here and a map in hive-compose.schema/SecretRef.

Secret references read from their stores at spawn. The port is hive-system's
`ISecretBackend`; a resolver is {scheme backend}, one backend per scheme a
reference may name. `:pass` is hive-system's PassBackend: `pass <path>`
through the injected `exec`, its first non-blank line, trimmed.

A failure names the variable, the reference and the store's reason, never a
value. A new scheme (`{:env "VAR"}`) is a backend of that id here and a map
in `hive-compose.schema/SecretRef`.
raw docstring

hive-compose.adapter.suite-runner

ISuiteRunner over the host and docker (hc-8, hc-16b): one suite runner run to its end under its resource caps, its OOM kill diagnosed, every secret it resolved scrubbed from what it answers.

A host command runs as systemd-run --user --scope --quiet --unit=hc-suite-<test>-<ms> -p MemoryMax=<cap> -p MemorySwapMax=0 -- <command> so a runaway is OOM-killed inside its own scope and cannot take the host down; the scope's Result (oom-kill) is read after the run and the unit reset. Without a systemd user manager the command runs under ulimit -v and the answer's :cap :note says so.

A container runs as docker image inspect, then docker pull when the image is absent (under its own :pull-timeout-ms, default 10 min, never the run's), docker create (name, view network, --mount binds, labels, -e VAR by NAME only, --memory <cap> --memory-swap <cap> --cpus n), docker network connect to each of :extra-networks, docker start -a with its output discarded (never drained into this heap) and read back through docker logs --tail, docker inspect (State.OOMKilled, ExitCode), then docker rm -f, which also runs after a failed step, a timeout or a throw. rm -f is never -v: volumes are never removed, so an image that declares a VOLUME leaves its anonymous volume behind, one per cell (docker volume ls -f dangling=true lists them).

Env values never reach an argv: secret references in :env are read here, at spawn, through the injected resolver (hive-compose.adapter.secrets), and travel in the env of the process (docker copies the named ones in). Every answer, ok or error, carries :scrub (fn [text]) -> text, which replaces every value resolved from a reference by that reference's rendering; the output, the OOM finding and every error message are already scrubbed.

Everything outside is injected: :exec (hive-system shell.core/exec! shape: argv, {:dir :env :timeout-ms} -> Result<{:exit :stdout :stderr}>), :now (epoch ms), :systemd? and :resolver.

ISuiteRunner over the host and docker (hc-8, hc-16b): one suite runner run
to its end under its resource caps, its OOM kill diagnosed, every secret
it resolved scrubbed from what it answers.

A host command runs as
  systemd-run --user --scope --quiet --unit=hc-suite-<test>-<ms>
              -p MemoryMax=<cap> -p MemorySwapMax=0 -- <command>
so a runaway is OOM-killed inside its own scope and cannot take the host
down; the scope's Result (oom-kill) is read after the run and the unit
reset. Without a systemd user manager the command runs under `ulimit -v`
and the answer's :cap :note says so.

A container runs as `docker image inspect`, then `docker pull` when the
image is absent (under its own `:pull-timeout-ms`, default 10 min, never
the run's), `docker create` (name, view network, `--mount` binds, labels,
`-e VAR` by NAME only, `--memory <cap> --memory-swap <cap> --cpus n`),
`docker network connect` to each of `:extra-networks`, `docker start -a`
with its output discarded (never drained into this heap) and read back
through `docker logs --tail`, `docker inspect` (State.OOMKilled,
ExitCode), then `docker rm -f`, which also runs after a failed step, a
timeout or a throw. `rm -f` is never `-v`: volumes are never removed, so
an image that declares a VOLUME leaves its anonymous volume behind, one
per cell (`docker volume ls -f dangling=true` lists them).

Env values never reach an argv: secret references in `:env` are read here,
at spawn, through the injected resolver (`hive-compose.adapter.secrets`),
and travel in the env of the process (docker copies the named ones in).
Every answer, ok or error, carries `:scrub` (fn [text]) -> text, which
replaces every value resolved from a reference by that reference's
rendering; the output, the OOM finding and every error message are
already scrubbed.

Everything outside is injected: `:exec` (hive-system `shell.core/exec!`
shape: argv, {:dir :env :timeout-ms} -> Result<{:exit :stdout :stderr}>),
`:now` (epoch ms), `:systemd?` and `:resolver`.
raw docstring

hive-compose.adapter.swarm

ISwarm over the hive host: the live agents come from the host's swarm registry, notices go out as hivemind messages. A notice addressed to one agent (:to) is sent directed, through the host's routing-verdict shout, so it lands in that agent's context only; with no directed channel it falls back to the plain shout. Everything is soft-resolved, so the published addon never requires hive-mcp; with no host, -agents answers :host/absent and -notify! an error, and the addon runs on claims and connections alone.

A delivered notice answers {:channel :direct|:broadcast ..}: :direct with the :to it reached (and the host's :context-id, :to-unresolved when the host knows no such reader), :broadcast when it went out as a shout, :fallback? true when it was meant for one agent but no directed channel resolved.

ISwarm over the hive host: the live agents come from the host's swarm
registry, notices go out as hivemind messages. A notice addressed to one
agent (:to) is sent directed, through the host's routing-verdict shout,
so it lands in that agent's context only; with no directed channel it
falls back to the plain shout. Everything is soft-resolved, so the
published addon never requires hive-mcp; with no host, `-agents` answers
:host/absent and `-notify!` an error, and the addon runs on claims and
connections alone.

A delivered notice answers {:channel :direct|:broadcast ..}: :direct with
the :to it reached (and the host's :context-id, :to-unresolved when the
host knows no such reader), :broadcast when it went out as a shout,
:fallback? true when it was meant for one agent but no directed channel
resolved.
raw docstring

hive-compose.adapter.tempo

ITraceQuery over Grafana Tempo's HTTP API (grafana/otel-lgtm serves it on :3200): GET /api/search?q=<TraceQL>&start&end&limit, GET /api/traces/<id> and GET /ready. The JDK's java.net.http client, no other dependency; the answers are read by hive-compose.promote.trace.

Every failure is a Result, never a throw: :trace/unreachable (connect failed, timed out), :trace/http-error (a non-2xx status, with :status and the start of the :body), :trace/not-found (404 on a trace), :trace/bad-json (an answer that does not parse or has a shape it cannot read), :trace/bad-id (a trace id that is not hex), :trace/not-ready (a non-2xx /ready).

The request timeout bounds the wait for the response headers; Tempo's answers are small JSON, read whole.

ITraceQuery over Grafana Tempo's HTTP API (grafana/otel-lgtm serves it on
:3200): GET /api/search?q=<TraceQL>&start&end&limit, GET
/api/traces/<id> and GET /ready. The JDK's java.net.http client, no other
dependency; the answers are read by `hive-compose.promote.trace`.

Every failure is a Result, never a throw: :trace/unreachable (connect
failed, timed out), :trace/http-error (a non-2xx status, with :status and
the start of the :body), :trace/not-found (404 on a trace),
:trace/bad-json (an answer that does not parse or has a shape it cannot
read), :trace/bad-id (a trace id that is not hex), :trace/not-ready (a
non-2xx /ready).

The request timeout bounds the wait for the response headers; Tempo's
answers are small JSON, read whole.
raw docstring

hive-compose.adapter.toxiproxy

IToxiproxyClient over Toxiproxy's REST API (port 8474) with java.net.http. Requests are built as pure values {:method :path :body}; the transport is an injected send (request -> Result<{:status :body}>), so the mapping of statuses to Results is tested without a server.

API: GET /proxies, POST /proxies, GET /proxies/{p}, POST /proxies/{p}/toxics, DELETE /proxies/{p}/toxics/{t}, POST /reset.

IToxiproxyClient over Toxiproxy's REST API (port 8474) with
java.net.http. Requests are built as pure values {:method :path :body};
the transport is an injected `send` (request -> Result<{:status :body}>),
so the mapping of statuses to Results is tested without a server.

API: GET /proxies, POST /proxies, GET /proxies/{p},
POST /proxies/{p}/toxics, DELETE /proxies/{p}/toxics/{t}, POST /reset.
raw 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