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)
Per-thread override for the global swarm connection.
When non-nil, get-conn returns this instead of the global atom.
Set through with-test-conn (the :swarm-ds isolation in
hive-mcp.isolation-methods) so tests run against a fresh in-memory conn
without polluting prod state. Honors axiom 20260122235103-7151cc29.
Per-thread override for the global swarm connection. When non-nil, get-conn returns this instead of the global atom. Set through `with-test-conn` (the :swarm-ds isolation in hive-mcp.isolation-methods) so tests run against a fresh in-memory conn without polluting prod state. Honors axiom 20260122235103-7151cc29.
(create-conn)Create a new DataScript connection with swarm schema. Returns the connection (atom wrapper around db).
Create a new DataScript connection with swarm schema. Returns the connection (atom wrapper around db).
(current-test-conn)This thread's test connection override, or nil.
This thread's test connection override, or nil.
DataScript connection: atom wrapping a DB, satisfies d/conn?.
DataScript connection: atom wrapping a DB, satisfies d/conn?.
(ensure-conn)Ensure connection exists, return it.
Ensure connection exists, return it.
(gen-id)(gen-id prefix)Generate a unique ID with optional prefix.
Generate a unique ID with optional prefix.
(get-conn)Get the global swarm connection, creating if needed. Returns test-conn when bound (test isolation override).
Get the global swarm connection, creating if needed. Returns *test-conn* when bound (test isolation override).
(now)Current timestamp as java.util.Date.
Current timestamp as java.util.Date.
(reset-conn!)Reset the global connection to empty state.
Reset the global connection to empty state.
(with-test-conn test-conn f)Run (F) with TEST-CONN as this thread's swarm connection.
Run (F) with TEST-CONN as this thread's swarm connection.
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 |