Expand description
daemon.json / daemon.lock / daemon.pid under registry_dir()
(PLAN-phase2 §2.11). The flock on daemon.lock is THE liveness oracle
(jcode socket.rs:89-139): a daemon is alive iff someone holds the lock.
A socket file with no lock holder is stale and gets unlinked. Nobody
unlinks on ECONNREFUSED alone.
Re-exports§
pub use crate::events::registry::daemon_paths;pub use crate::events::registry::daemon_paths_in;pub use crate::events::registry::DaemonPaths;
Structs§
- Daemon
Info daemon.json— pid + profile + paths only. Never credentials.- Daemon
Lock - Held for the daemon’s lifetime; dropping releases the flock.
- Metadata
- The daemon’s
daemon.jsonrecord as this image holds it, and the writes of it: the start write,Self::publish(reload, and the restore after a failed exec),Self::heal(Ping) andSelf::cleanup(shutdown). - Spawn
Lock - Held while a client spawns the daemon; dropping releases it.
Enums§
- Healed
- What
Metadata::healdid.
Constants§
- JSON_
HEAL_ LOG_ EVERY - At most one
daemon.json rewrittenline per this interval; heals in between are counted in the next line.
Functions§
- heal_
daemon_ json - The lock holder puts its own
daemon.json(anddaemon.pid) back when the file is missing, unreadable, or names another pid: an oldersynapsthat lists sessions unlinks every run-dir*.jsonit cannot parse as a session card.infois the record the daemon holds in memory; the write iswrite_daemon_json’s (tmp + rename, 0600). Anything at the path that is not a regular file (a symlink, a directory, a socket) is left alone, as [cleanup_metadata] does. Returns whether it wrote. - is_
alive - Liveness probe: try to take the lock; success means nobody holds it (dead or never started) — release immediately. Never unlinks anything.
- read_
daemon_ json - reap_
stale - Unlink
sock/json/pidif — and only if — no daemon holds the lock. Returnstruewhen something stale was removed. - write_
daemon_ json - Write
daemon.json+daemon.pidatomically (each through its own temp file + rename), 0600. - write_
private_ atomic - 0600 temp file + rename (reload-state), as [
write_atomic].