Liking cljdoc? Tell your friends :D

hive-compose.promote.swarm

Pure: who works on what a section runs, which shared nREPL drives which module, and whether a section is in use.

Agents are {:agent/id :agent/status :agent/cwd}. A claim is what an agent declared itself, kept on the active entry under :claims {agent-id {:since ms :seen ms :note s :swarm? bool}}. A route is one program with an nREPL: {:dir :program/id :project :nrepl-port ..}.

Pure: who works on what a section runs, which shared nREPL drives which
module, and whether a section is in use.

Agents are {:agent/id :agent/status :agent/cwd}. A claim is what an agent
declared itself, kept on the active entry under :claims
{agent-id {:since ms :seen ms :note s :swarm? bool}}. A route is one
program with an nREPL: {:dir :program/id :project :nrepl-port ..}.
raw docstring

agents-inclj

(agents-in agents dirs)

The agents of agents whose cwd lies under one of dirs, by id.

The agents of `agents` whose cwd lies under one of `dirs`, by id.
sourceraw docstring

best-routeclj

(best-route routes path)

The route of routes whose :dir holds path most closely (the deepest directory), nil when none does.

The route of `routes` whose :dir holds `path` most closely (the deepest
directory), nil when none does.
sourceraw docstring

busy-servicesclj

(busy-services load threshold footprint)

{service percent} of load ({service percent}) above threshold, among the services of footprint (all of load when nil). A reading that is no number is left out.

{service percent} of `load` ({service percent}) above `threshold`, among
the services of `footprint` (all of `load` when nil). A reading that is
no number is left out.
sourceraw docstring

claimclj

(claim claims agent now {:keys [note swarm? until]})

claims with agent claiming at now. A renewed claim keeps its :since, and its note unless a new one is given. until (absolute ms) makes it a WAVE claim, live until then whatever the swarm says; a renewal with an until moves it. One without leaves a live wave claim as it was, and turns a wave claim whose :until has passed into a plain claim (lapsed-wave).

`claims` with `agent` claiming at `now`. A renewed claim keeps its :since,
and its note unless a new one is given. `until` (absolute ms) makes it a
WAVE claim, live until then whatever the swarm says; a renewal with an
`until` moves it. One without leaves a live wave claim as it was, and
turns a wave claim whose :until has passed into a plain claim
(`lapsed-wave`).
sourceraw docstring

claim-endclj

(claim-end agent claim live now ttl-ms)

Why claim of agent no longer holds at now, nil while it holds. THE one liveness law for section and stack-run claims:

  • a wave claim (:until) holds while now < :until, and nothing else counts: not the swarm roster, not :seen. Past it: :expired;
  • any other claim ends :gone when its agent was in the swarm when it claimed (:swarm?) and the swarm (live, a set of ids; nil when no swarm answers or none is asked) no longer lists it, and :stale when not renewed for ttl-ms. Monotone in now: once ended, a claim stays ended at every later now.
Why `claim` of `agent` no longer holds at `now`, nil while it holds. THE
one liveness law for section and stack-run claims:
  - a wave claim (:until) holds while `now` < :until, and nothing else
    counts: not the swarm roster, not :seen. Past it: :expired;
  - any other claim ends :gone when its agent was in the swarm when it
    claimed (:swarm?) and the swarm (`live`, a set of ids; nil when no
    swarm answers or none is asked) no longer lists it, and :stale when
    not renewed for `ttl-ms`.
Monotone in `now`: once ended, a claim stays ended at every later now.
sourceraw docstring

claim-live?clj

(claim-live? agent claim live now ttl-ms)

True while claim of agent holds at now (see claim-end).

True while `claim` of `agent` holds at `now` (see `claim-end`).
sourceraw docstring

claim-viewclj

(claim-view claim now ttl-ms)

What status, who and stack-status show of one claim: note, since, seen, whether it is a wave claim (with its :until) and expires-in-seconds.

What status, who and stack-status show of one claim: note, since, seen,
whether it is a wave claim (with its :until) and expires-in-seconds.
sourceraw docstring

claims-viewclj

(claims-view claims now ttl-ms)

{agent claim-view} of claims, sorted by agent (the owner).

{agent claim-view} of `claims`, sorted by agent (the owner).
sourceraw docstring

clean-dirclj

(clean-dir dir)

dir normalized: . and .. segments resolved lexically (no filesystem read, links untouched) and no trailing slash ("/" stays itself); nil when blank. A configured dir like dc/../../wt/app and an agent's cwd /wt/app/src then compare as the same tree.

`dir` normalized: `.` and `..` segments resolved lexically (no filesystem
read, links untouched) and no trailing slash ("/" stays itself); nil
when blank. A configured dir like `dc/../../wt/app` and an agent's cwd
`/wt/app/src` then compare as the same tree.
sourceraw docstring

concernedclj

(concerned agents claimants)

The agents a section's notices concern: agents (those working in its project's directories) and the claimants (agent ids holding a claim on it), distinct and sorted by id. A claimant the swarm does not list stands as {:agent/id id}.

The agents a section's notices concern: `agents` (those working in its
project's directories) and the `claimants` (agent ids holding a claim on
it), distinct and sorted by id. A claimant the swarm does not list stands
as {:agent/id id}.
sourceraw docstring

expired-claimsclj

(expired-claims claims live now ttl-ms)

{agent reason} of the claims in claims that no longer hold at now (claim-end): :expired, :gone or :stale.

{agent reason} of the claims in `claims` that no longer hold at `now`
(`claim-end`): :expired, :gone or :stale.
sourceraw docstring

expires-in-secondsclj

(expires-in-seconds claim now ttl-ms)

Seconds until claim ends by the clock at now (its :until for a wave claim, :seen plus ttl-ms otherwise), never below 0. A plain claim may end sooner when its agent leaves the swarm.

Seconds until `claim` ends by the clock at `now` (its :until for a wave
claim, :seen plus `ttl-ms` otherwise), never below 0. A plain claim may
end sooner when its agent leaves the swarm.
sourceraw docstring

fresh-peersclj

(fresh-peers before now)

{port #{peer}} of now absent from before: connections opened since the last look. A long-lived connection (a pool, an editor left attached) counts once, when first seen.

{port #{peer}} of `now` absent from `before`: connections opened since the
last look. A long-lived connection (a pool, an editor left attached)
counts once, when first seen.
sourceraw docstring

lapsed-waveclj

(lapsed-wave claim now until)

True when renewing claim at now without a new until finds a wave claim whose :until has already passed: the renewal then makes it a plain claim from now, which is what a caller who leaves out ttl_minutes means. Without this the renewal would keep the stale :until, answer ok and be dropped as :expired on the next pass.

True when renewing `claim` at `now` without a new `until` finds a wave
claim whose :until has already passed: the renewal then makes it a plain
claim from `now`, which is what a caller who leaves out ttl_minutes means.
Without this the renewal would keep the stale :until, answer ok and be
dropped as :expired on the next pass.
sourceraw docstring

noticesclj

(notices working routes-by-section told)

[{:agent id :section id :routes [route]}] for the agents of working ({section-id [agent]}) not yet told about that section (told, a set of [agent-id section-id]), when the section has a ready route to tell.

[{:agent id :section id :routes [route]}] for the agents of `working`
({section-id [agent]}) not yet told about that section (`told`, a set of
[agent-id section-id]), when the section has a ready route to tell.
sourceraw docstring

peer-hostclj

(peer-host peer)

The address of peer ("ip:port", or "[ip6]:port"), nil when it has no port.

The address of `peer` ("ip:port", or "[ip6]:port"), nil when it has no port.
sourceraw docstring

project-dirsclj

(project-dirs proj)

The directories a configured project's work happens in: its own and those of its programs, sorted, distinct.

The directories a configured project's work happens in: its own and those
of its programs, sorted, distinct.
sourceraw docstring

published-peers?clj

(published-peers? fresh ports)

True when fresh ({port #{peer}}) holds a peer on a port ports ({port source}) marks :published: only then is it worth asking who the project's own containers are.

True when `fresh` ({port #{peer}}) holds a peer on a port `ports` ({port
source}) marks :published: only then is it worth asking who the project's
own containers are.
sourceraw docstring

route-adviceclj

(route-advice {:keys [dir nrepl-port nrepl-ready? running? project] :as route})

One line telling an agent how to drive the module of route.

One line telling an agent how to drive the module of `route`.
sourceraw docstring

section-freshclj

(section-fresh fresh ports own)

The fresh peers ({port #{peer}}) of a section watching ports ({port source}): those on its ports, with the peers its own containers hold (addresses own) left out on its :published ones, where a container's pool to a sibling's port would otherwise look like use.

The fresh peers ({port #{peer}}) of a section watching `ports` ({port
source}): those on its ports, with the peers its own containers hold
(addresses `own`) left out on its :published ones, where a container's
pool to a sibling's port would otherwise look like use.
sourceraw docstring

under?clj

(under? dir path)

True when path is dir or lies below it.

True when `path` is `dir` or lies below it.
sourceraw docstring

usageclj

(usage {:keys [claims agents fresh sources busy]})

{:in-use? bool :by [reason] :sources [source]} of an active section from what one pass saw: claims still holding, agents working in its project's directories, fresh ({port #{peer}}) connections opened to its ports since the last pass, each port's source (:nrepl, :published) given by sources ({port source}), and busy ({service percent}) services found working on their own (see busy-services). A reason is {:claim agent}, {:agent id}, {:port p :peers n :source s} or {:service s :cpu percent :source :cpu}; :sources names, in that order and once each, what the reasons came from: :claim, :agent, a port's source (:port when sources does not name it), :cpu.

{:in-use? bool :by [reason] :sources [source]} of an active section from
what one pass saw: `claims` still holding, `agents` working in its
project's directories, `fresh` ({port #{peer}}) connections opened to
its ports since the last pass, each port's source (:nrepl, :published)
given by `sources` ({port source}), and `busy` ({service percent}) services
found working on their own (see `busy-services`). A reason is {:claim
agent}, {:agent id}, {:port p :peers n :source s} or {:service s :cpu
percent :source :cpu}; :sources names, in that order and once each, what
the reasons came from: :claim, :agent, a port's source (:port when
`sources` does not name it), :cpu.
sourceraw docstring

wave-untilclj

(wave-until now ttl-minutes max-minutes note)

Result<until-or-nil>: the absolute :until of a claim asked at now with ttl-minutes (nil when none was asked: a plain claim). Refused when it is not a positive integer (invalid-param), above max-minutes (claim-ttl-over-max, naming the bound: never clamped), or when the claim has no non-blank note (missing-param): a wave claim outlives its agent, so it must say what it holds the section for.

Result<until-or-nil>: the absolute :until of a claim asked at `now` with
`ttl-minutes` (nil when none was asked: a plain claim). Refused when it is
not a positive integer (invalid-param), above `max-minutes`
(claim-ttl-over-max, naming the bound: never clamped), or when the claim
has no non-blank `note` (missing-param): a wave claim outlives its agent,
so it must say what it holds the section for.
sourceraw docstring

wave?clj

(wave? claim)

True when claim is a wave claim: it carries an absolute :until.

True when `claim` is a wave claim: it carries an absolute :until.
sourceraw docstring

without-hostsclj

(without-hosts peers hosts)

{port #{peer}} of peers with the peers whose address is one of hosts left out, and the ports left with none dropped. The connections a project's own containers hold to its published ports are not its use.

{port #{peer}} of `peers` with the peers whose address is one of `hosts`
left out, and the ports left with none dropped. The connections a
project's own containers hold to its published ports are not its use.
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