Protocol definition for Emacs daemon lifecycle management.
Abstracts daemon registration, heartbeat, ling binding, and stale detection so that different storage backends (DataScript, Datalevin) can be used interchangeably.
This namespace owns only daemon domain contracts.
Protocol definition for Emacs daemon lifecycle management. Abstracts daemon registration, heartbeat, ling binding, and stale detection so that different storage backends (DataScript, Datalevin) can be used interchangeably. This namespace owns only daemon domain contracts.
Valid Emacs daemon status values.
:active - Running and sending heartbeats :stale - Not sending heartbeats (likely crashed) :error - In error state (Emacs reported errors) :terminated - Gracefully shutdown
Valid Emacs daemon status values. :active - Running and sending heartbeats :stale - Not sending heartbeats (likely crashed) :error - In error state (Emacs reported errors) :terminated - Gracefully shutdown
Lifecycle management protocol for Emacs daemon instances.
Each Emacs daemon is identified by a unique ID (typically the socket name). Daemons go through a lifecycle: register -> heartbeat -> terminate. Lings can be bound/unbound to track which agents use which daemon.
Implementations:
Lifecycle management protocol for Emacs daemon instances. Each Emacs daemon is identified by a unique ID (typically the socket name). Daemons go through a lifecycle: register -> heartbeat -> terminate. Lings can be bound/unbound to track which agents use which daemon. Implementations: - DataScriptDaemonStore: In-memory, used by swarm coordination
(bind-ling! this daemon-id ling-id)Bind a ling to this daemon (track which agents use which Emacs).
Arguments: daemon-id - Daemon to bind to ling-id - Ling/slave ID to bind
Returns: Transaction report or nil if daemon not found
Bind a ling to this daemon (track which agents use which Emacs). Arguments: daemon-id - Daemon to bind to ling-id - Ling/slave ID to bind Returns: Transaction report or nil if daemon not found
(heartbeat! this daemon-id)Update a daemon's heartbeat timestamp. Also ensures status is :active (reactivates stale/error daemons).
Arguments: daemon-id - Daemon to update
Returns: Transaction report or nil if daemon not found
Update a daemon's heartbeat timestamp. Also ensures status is :active (reactivates stale/error daemons). Arguments: daemon-id - Daemon to update Returns: Transaction report or nil if daemon not found
(get-daemon-for-ling this ling-id)Find the daemon a specific ling is bound to.
Arguments: ling-id - Ling/slave ID to look up
Returns: Daemon map or nil if ling is not bound to any daemon
Find the daemon a specific ling is bound to. Arguments: ling-id - Ling/slave ID to look up Returns: Daemon map or nil if ling is not bound to any daemon
(update-daemon! this daemon-id attrs)Merge host-neutral daemon attributes into an existing daemon entity. Unknown daemon IDs return nil.
Merge host-neutral daemon attributes into an existing daemon entity. Unknown daemon IDs return nil.
(get-daemons-by-status this status)Get daemons filtered by status.
Arguments: status - Status to filter by (:active :stale :error :terminated)
Returns: Seq of daemon maps
Get daemons filtered by status. Arguments: status - Status to filter by (:active :stale :error :terminated) Returns: Seq of daemon maps
(get-daemon this daemon-id)Get a daemon by ID.
Returns: Map with daemon attributes or nil if not found
Get a daemon by ID. Returns: Map with daemon attributes or nil if not found
(unbind-ling! this daemon-id ling-id)Unbind a ling from this daemon.
Arguments: daemon-id - Daemon to unbind from ling-id - Ling/slave ID to unbind
Returns: Transaction report or nil if daemon not found
Unbind a ling from this daemon. Arguments: daemon-id - Daemon to unbind from ling-id - Ling/slave ID to unbind Returns: Transaction report or nil if daemon not found
(mark-error! this daemon-id error-message)Mark a daemon as being in error state.
Arguments: daemon-id - Daemon to mark error-message - Human-readable error description
Returns: Transaction report or nil if daemon not found
Mark a daemon as being in error state. Arguments: daemon-id - Daemon to mark error-message - Human-readable error description Returns: Transaction report or nil if daemon not found
(get-all-daemons this)Get all registered daemons.
Returns: Seq of daemon attribute maps
Get all registered daemons. Returns: Seq of daemon attribute maps
(mark-terminated! this daemon-id)Mark a daemon as gracefully terminated.
Arguments: daemon-id - Daemon to mark
Returns: Transaction report or nil if daemon not found
Mark a daemon as gracefully terminated. Arguments: daemon-id - Daemon to mark Returns: Transaction report or nil if daemon not found
(cleanup-stale! this)(cleanup-stale! this opts)Find and mark daemons as stale if their heartbeat is too old.
Arguments: opts - Optional map with :threshold-ms (default: 2 minutes)
Returns: Seq of daemon-ids that were marked stale
CLARITY-Y: Graceful degradation - marks as stale rather than deleting.
Find and mark daemons as stale if their heartbeat is too old. Arguments: opts - Optional map with :threshold-ms (default: 2 minutes) Returns: Seq of daemon-ids that were marked stale CLARITY-Y: Graceful degradation - marks as stale rather than deleting.
(register! this daemon-id opts)Register a new Emacs daemon instance.
Arguments: daemon-id - Unique identifier (e.g., socket name) opts - Map with optional keys: :socket-name - Emacs socket name (defaults to daemon-id) :pid - OS process ID :emacsclient - Path to emacsclient binary
Returns: Transaction report
Register a new Emacs daemon instance.
Arguments:
daemon-id - Unique identifier (e.g., socket name)
opts - Map with optional keys:
:socket-name - Emacs socket name (defaults to daemon-id)
:pid - OS process ID
:emacsclient - Path to emacsclient binary
Returns:
Transaction reportcljdoc 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 |