Swarm work on the sections the addon runs, over the ops context plus:
{:swarm ISwarm ; optional: live agents and notices :activity IActivity} ; optional: connections to local ports
Nothing here starts a JVM for an agent: routes point at the programs the sections run, so a swarm shares one nREPL per module instead of each agent booting its own.
Swarm work on the sections the addon runs, over the ops context plus:
{:swarm ISwarm ; optional: live agents and notices
:activity IActivity} ; optional: connections to local ports
* routes: which shared nREPL drives which module (a program directory).
* claims: an agent declares it works on a section; a claim keeps the
section alive while renewed, and ends after the claim TTL or when the
agent leaves the swarm.
* observe!: one pass of the reaper. It expires claims, counts as use the
claims that hold, the agents whose cwd lies in the section's project and
the connections newly opened to its nREPL (and, opt-in per project with
:project/activity, published) ports, the connections its own containers
hold to those left out, touches what is in use, records which source
counted (:usage :sources), marks a section whose last claim ended orphaned
(reaped after the shorter orphan TTL), and tells each agent once which
shared nREPL drives the module it works in.
Nothing here starts a JVM for an agent: routes point at the programs the
sections run, so a swarm shares one nREPL per module instead of each agent
booting its own.(announce-reaped! ctx reaped)Tell the swarm what a reaper pass released, nil when nothing was.
Tell the swarm what a reaper pass released, nil when nothing was.
(announce-up! ctx sid)Tell the swarm section sid is up and which shared nREPLs it serves.
Answers the notice result, nil when there was nothing to tell or notices
are off.
Tell the swarm section `sid` is up and which shared nREPLs it serves. Answers the notice result, nil when there was nothing to tell or notices are off.
(claim! ctx p agent {:keys [note]})Result: agent claims section p, bringing it up first when it is not
active. The answer carries the section's shared nREPL routes with advice,
so the agent drives them instead of starting its own JVM. A renewed claim
resets its TTL; note says what the agent works on.
Result: `agent` claims section `p`, bringing it up first when it is not active. The answer carries the section's shared nREPL routes with advice, so the agent drives them instead of starting its own JVM. A renewed claim resets its TTL; `note` says what the agent works on.
(nrepl ctx {:keys [path project]})Result: the shared nREPL to drive path with (the program whose directory
holds it most closely), or with no path every route (of project when
given), each with one line of advice.
Result: the shared nREPL to drive `path` with (the program whose directory holds it most closely), or with no path every route (of `project` when given), each with one line of advice.
(observe! ctx)One usage pass over the active sections (see the ns doc). Answers {:swarm :ok|:absent|:off :agents n :in-use [id] :expired [{:section :agent :reason}] :orphaned [id] :notified [{:agent :section :channel}]}, where :channel says how the agent's route notice went out: :direct to it, or :broadcast when no directed channel resolved. A route notice goes to the agents a section concerns: those holding a claim on it and those whose cwd lies in its project's directories.
One usage pass over the active sections (see the ns doc). Answers
{:swarm :ok|:absent|:off :agents n :in-use [id] :expired [{:section :agent
:reason}] :orphaned [id] :notified [{:agent :section :channel}]}, where
:channel says how the agent's route notice went out: :direct to it, or
:broadcast when no directed channel resolved. A route notice goes to the
agents a section concerns: those holding a claim on it and those whose
cwd lies in its project's directories.(release-claim! ctx p agent {:keys [stop?]})Result: agent gives up its claim on section p. When no claim is left the
section is orphaned: the reaper takes it after the orphan TTL unless
something else uses it, or at once with stop?, which stops what no other
section needs.
Result: `agent` gives up its claim on section `p`. When no claim is left the section is orphaned: the reaper takes it after the orphan TTL unless something else uses it, or at once with `stop?`, which stops what no other section needs.
(routes ctx)[route]: every program with an nREPL that a configured project declares or an active section holds, where its nREPL listens and whether it answers now. A route whose nREPL answers but that no section holds is :external? (somebody else runs it; it is shared all the same). Empty without a program runner.
[route]: every program with an nREPL that a configured project declares or an active section holds, where its nREPL listens and whether it answers now. A route whose nREPL answers but that no section holds is :external? (somebody else runs it; it is shared all the same). Empty without a program runner.
(section-activity ctx sid a)Which new connections count as use of active section sid/a: its
project's :project/activity (a preset's :profile/activity), else the
global :compose/activity.
Which new connections count as use of active section `sid`/`a`: its project's :project/activity (a preset's :profile/activity), else the global :compose/activity.
(section-routes rs a)The routes of active entry a's compose project: the shared nREPLs of the
app it runs.
The routes of active entry `a`'s compose project: the shared nREPLs of the app it runs.
(who ctx)Result<{:sections [..] :agents [..]}>: per active section its claims, what the last pass saw using it and when the reaper takes it; per live agent (when a swarm answers) the sections whose project it works in.
Result<{:sections [..] :agents [..]}>: per active section its claims, what
the last pass saw using it and when the reaper takes it; per live agent
(when a swarm answers) the sections whose project it works in.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 |