Singleton daemon store for shared access across modules.
Provides a shared IEmacsDaemon store instance that can be accessed from swarm sync, emacsclient, and coordinator modules.
DDD: Infrastructure layer - singleton access to repository.
Singleton daemon store for shared access across modules. Provides a shared IEmacsDaemon store instance that can be accessed from swarm sync, emacsclient, and coordinator modules. DDD: Infrastructure layer - singleton access to repository.
(bind-ling! daemon-id ling-id)Bind a ling to a daemon. Delegates to IEmacsDaemon.bind-ling!
Bind a ling to a daemon. Delegates to IEmacsDaemon.bind-ling!
(cleanup-stale!)(cleanup-stale! opts)Cleanup stale daemons. Delegates to IEmacsDaemon.cleanup-stale!
Cleanup stale daemons. Delegates to IEmacsDaemon.cleanup-stale!
(default-daemon-id)Get the default daemon ID from environment or use 'server'. This matches the socket name used by emacs-socket-name in emacsclient.clj. Delegates to hive-emacs.config — single source of truth.
Get the default daemon ID from environment or use 'server'. This matches the socket name used by *emacs-socket-name* in emacsclient.clj. Delegates to hive-emacs.config — single source of truth.
(ensure-default-daemon!)Ensure the default daemon is registered. Call this during system startup to bootstrap daemon tracking.
Returns: Transaction report from register! or nil if already exists
Ensure the default daemon is registered. Call this during system startup to bootstrap daemon tracking. Returns: Transaction report from register! or nil if already exists
(get-all-daemons)Get all registered daemons. Delegates to IEmacsDaemon.get-all-daemons
Get all registered daemons. Delegates to IEmacsDaemon.get-all-daemons
(get-daemon daemon-id)Get daemon by ID. Delegates to IEmacsDaemon.get-daemon
Get daemon by ID. Delegates to IEmacsDaemon.get-daemon
(get-daemon-for-ling ling-id)Find daemon for a ling. Delegates to IEmacsDaemon.get-daemon-for-ling
Find daemon for a ling. Delegates to IEmacsDaemon.get-daemon-for-ling
(get-daemons-by-status status)Get daemons by status. Delegates to IEmacsDaemon.get-daemons-by-status
Get daemons by status. Delegates to IEmacsDaemon.get-daemons-by-status
(get-store)Get the shared daemon store instance. Lazily initializes on first call.
Returns: IEmacsDaemon implementation (DataScriptDaemonStore)
Get the shared daemon store instance. Lazily initializes on first call. Returns: IEmacsDaemon implementation (DataScriptDaemonStore)
(heal-orphans!)Manually trigger orphan detection and healing. Useful for immediate cleanup outside the heartbeat cycle.
Returns: Map with :orphans-found, :healed, :failed, :results or nil if no orphans found.
Manually trigger orphan detection and healing. Useful for immediate cleanup outside the heartbeat cycle. Returns: Map with :orphans-found, :healed, :failed, :results or nil if no orphans found.
(heartbeat! daemon-id)Update daemon heartbeat. Delegates to IEmacsDaemon.heartbeat!
Update daemon heartbeat. Delegates to IEmacsDaemon.heartbeat!
(heartbeat-status)Get current heartbeat loop status.
Returns: Map with :running?, :last-heartbeat, :last-cleanup, :daemon-status, :health-score, :health-level (W2 additions), :last-autoheal, :last-autoheal-result (W3 additions), :last-redistribution, :last-redistribution-result (W4 additions)
Get current heartbeat loop status. Returns: Map with :running?, :last-heartbeat, :last-cleanup, :daemon-status, :health-score, :health-level (W2 additions), :last-autoheal, :last-autoheal-result (W3 additions), :last-redistribution, :last-redistribution-result (W4 additions)
(mark-error! daemon-id error-message)Mark daemon as errored. Delegates to IEmacsDaemon.mark-error!
Mark daemon as errored. Delegates to IEmacsDaemon.mark-error!
(mark-terminated! daemon-id)Mark daemon as terminated. Delegates to IEmacsDaemon.mark-terminated!
Mark daemon as terminated. Delegates to IEmacsDaemon.mark-terminated!
(orphan-status)Get current orphan status without healing. Monitoring endpoint.
Returns: Map with :orphan-count, :orphans (with classified actions) or nil if no orphans.
Get current orphan status without healing. Monitoring endpoint. Returns: Map with :orphan-count, :orphans (with classified actions) or nil if no orphans.
(redistribute-lings!)Manually trigger ling redistribution from overloaded/degraded daemons. Useful for immediate rebalancing outside the heartbeat cycle.
Returns: Map with :migrations-planned, :migrations-executed, :migrations-failed, :results or nil if no redistribution needed.
Manually trigger ling redistribution from overloaded/degraded daemons. Useful for immediate rebalancing outside the heartbeat cycle. Returns: Map with :migrations-planned, :migrations-executed, :migrations-failed, :results or nil if no redistribution needed.
(redistribution-status)Get current redistribution status without executing. Monitoring endpoint.
Returns: Map with :overloaded-count, :overloaded-daemons, :planned-migrations or nil if system is balanced.
Get current redistribution status without executing. Monitoring endpoint. Returns: Map with :overloaded-count, :overloaded-daemons, :planned-migrations or nil if system is balanced.
(register! daemon-id opts)Register a new Emacs daemon. Delegates to IEmacsDaemon.register!
Register a new Emacs daemon. Delegates to IEmacsDaemon.register!
(reset-store!)(reset-store! store)Replace the singleton repository. Intended for lifecycle reset and tests.
Replace the singleton repository. Intended for lifecycle reset and tests.
(select-daemon-for-ling)(select-daemon-for-ling opts)Select the best daemon for a new ling spawn.
Uses health scoring, capacity limits, and project affinity to pick the optimal daemon. Falls back to default daemon if no better option.
Arguments: opts - Optional map with: :project-id - Target project for affinity scoring
Returns: Map with :daemon-id and :reason (:selected, :no-daemons, :all-disqualified)
Select the best daemon for a new ling spawn.
Uses health scoring, capacity limits, and project affinity to pick
the optimal daemon. Falls back to default daemon if no better option.
Arguments:
opts - Optional map with:
:project-id - Target project for affinity scoring
Returns:
Map with :daemon-id and :reason (:selected, :no-daemons, :all-disqualified)(start-heartbeat-loop!)Start the background heartbeat loop. Idempotent - does nothing if already running.
Returns: Current heartbeat state
Start the background heartbeat loop. Idempotent - does nothing if already running. Returns: Current heartbeat state
(stop-heartbeat-loop!)Stop the background heartbeat loop. Idempotent - does nothing if not running.
Returns: Current heartbeat state
Stop the background heartbeat loop. Idempotent - does nothing if not running. Returns: Current heartbeat state
(unbind-ling! daemon-id ling-id)Unbind a ling from a daemon. Delegates to IEmacsDaemon.unbind-ling!
Unbind a ling from a daemon. Delegates to IEmacsDaemon.unbind-ling!
(update-daemon-health! daemon-id score)Update a daemon's health score. Delegates to daemon-selection.
Arguments: daemon-id - Daemon to update score - New health score (0-100)
Update a daemon's health score. Delegates to daemon-selection. Arguments: daemon-id - Daemon to update score - New health score (0-100)
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 |