DataScript connection management for swarm state.
Provides:
DataScript connection management for swarm state. Provides: - Global connection atom (thread-safe via DataScript internals) - Connection lifecycle (create, get, reset) - Shared helper functions (now, gen-id)
Stale-detection sweeps for coordinators and claims.
Pure side-effect cleanup ops. Owns the staleness policy via CoordinationConfig (env-overridable thresholds). Sibling to coordination.coordinator (which owns coordinator CRUD); kept separate per SRP: these have a different reason to change (threshold tuning, sweep cadence) than the CRUD ops.
Stale-detection sweeps for coordinators and claims. Pure side-effect cleanup ops. Owns the staleness policy via CoordinationConfig (env-overridable thresholds). Sibling to coordination.coordinator (which owns coordinator CRUD); kept separate per SRP: these have a different reason to change (threshold tuning, sweep cadence) than the CRUD ops.
Typed config for hive-mcp.swarm.datascript.coordination.* via hive-di defconfig.
Replaces:
(def ^:private stale-threshold-ms (* 2 60 1000)) (private constant)
in hive-mcp.swarm.datascript.coordination, with an env-overridable
:coordinator-stale-ms field.(* 5 60 1000) default in cleanup-stale-claims!, with an
env-overridable :claim-stale-ms field.Resolution order (per field): default <- env <- caller overrides.
Tests can override the resolver via with-redefs:
(with-redefs [hive-mcp.swarm.datascript.coordination.config/coordination-config (fn [] {:coordinator-stale-ms 1000 :claim-stale-ms 5000})] ...)
Generated by defconfig: CoordinationConfig — ADT CoordinationConfig-fields — field registry CoordinationConfig-schema — Malli schema resolve-CoordinationConfig — resolver fn (returns Result)
Moved from hive-mcp.swarm.datascript.coordination.config (hive-mcp).
Typed config for hive-mcp.swarm.datascript.coordination.* via hive-di defconfig.
Replaces:
- `(def ^:private stale-threshold-ms (* 2 60 1000))` (private constant)
in hive-mcp.swarm.datascript.coordination, with an env-overridable
:coordinator-stale-ms field.
- Inline `(* 5 60 1000)` default in `cleanup-stale-claims!`, with an
env-overridable :claim-stale-ms field.
Resolution order (per field): default <- env <- caller overrides.
Tests can override the resolver via with-redefs:
(with-redefs [hive-mcp.swarm.datascript.coordination.config/coordination-config
(fn [] {:coordinator-stale-ms 1000 :claim-stale-ms 5000})]
...)
Generated by defconfig:
CoordinationConfig — ADT
CoordinationConfig-fields — field registry
CoordinationConfig-schema — Malli schema
resolve-CoordinationConfig — resolver fn (returns Result)
Moved from hive-mcp.swarm.datascript.coordination.config (hive-mcp).Session-scoped registry of what a run produced, for wrap to harvest.
SCOPING: every row carries the session that wrote it. A reader passes a
:session-ref (plus :parent-of) and gets back only the rows that session
owns. Ownership is the host's rule, applied through the :scope-rows hook
(hive-datascript.swarm.hooks). Reads WITHOUT a :session-ref keep the
unscoped behaviour, but clearing is never unscoped by accident: clear-*
takes the explicit ids the caller actually harvested.
Session-scoped registry of what a run produced, for wrap to harvest. SCOPING: every row carries the session that wrote it. A reader passes a `:session-ref` (plus `:parent-of`) and gets back only the rows that session owns. Ownership is the host's rule, applied through the :scope-rows hook (hive-datascript.swarm.hooks). Reads WITHOUT a :session-ref keep the unscoped behaviour, but clearing is never unscoped by accident: clear-* takes the explicit ids the caller actually harvested.
Host-installed hooks the swarm store calls on write paths.
The store never names the orchestration layer. The host installs:
Host-installed hooks the swarm store calls on write paths. The store never names the orchestration layer. The host installs: - :ledger-append (fn [event]) durable write-through for terminal events - :claim-released (fn [file-path]) mirror a released claim elsewhere (e.g. the core.logic claim db) - :stale-threshold-ms activity window for hiding stale ling rows Absent hooks are no-ops; an absent threshold falls back to 30 minutes.
Entity lifecycle operations for lings (slaves, tasks, claims).
CRUD operations for:
DDD: Repository pattern for swarm entities.
Entity lifecycle operations for lings (slaves, tasks, claims). CRUD operations for: - Slave entities (add, update, remove) - Task entities (add, complete, fail) - Claim entities (claim, release, batch release) - Critical operations guard (kill protection) - Claim TTL (stale detection, auto-expiration) DDD: Repository pattern for swarm entities.
Read-only query operations for swarm state.
Query functions for:
Read-only query operations for swarm state. Query functions for: - Slave queries (get, list, filter by status) - Task queries (get, list for slave, completed tasks) - Claim queries (get, list, conflict detection) - Statistics and debugging
DataScript implementation of all ISP-segregated swarm protocols (hive-spi.swarm.protocol), plus the default instances a host installs.
DataScript implementation of all ISP-segregated swarm protocols (hive-spi.swarm.protocol), plus the default instances a host installs.
DataScript schema definitions for swarm hivemind coordination.
Contains:
DDD: Value Objects for status enums, schema as domain model.
DataScript schema definitions for swarm hivemind coordination. Contains: - Entity schemas (slave, task, claim, wrap-queue, etc.) - Status enumerations for validation - Schema documentation DDD: Value Objects for status enums, schema as domain model.
Slave rows, read once per connection and then kept current from each transaction's delta.
Reading every slave entity is the expensive part of a roster query: the swarm keeps every row it ever saw, so a full read materializes thousands of entities to return the handful that are live. This index pays that cost once, then re-reads only the slave entities a transaction touched.
Consumers that want to react instead of poll subscribe! and are called
after any transaction that changed a slave row.
Slave rows, read once per connection and then kept current from each transaction's delta. Reading every slave entity is the expensive part of a roster query: the swarm keeps every row it ever saw, so a full read materializes thousands of entities to return the handful that are live. This index pays that cost once, then re-reads only the slave entities a transaction touched. Consumers that want to react instead of poll `subscribe!` and are called after any transaction that changed a slave row.
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 |