Skip to main content

Module discovery

Module discovery 

Source
Expand description

Discovery file management for the single-instance daemon.

The daemon writes a JSON file to ~/.hyperdb/daemon.json containing its PID and the hyperd endpoint. Clients read this file to locate the running daemon, validating liveness via a TCP health check before trusting it.

Structs§

DaemonInfo
Information written by the daemon so clients can discover and connect.

Functions§

discover
Read the discovery file and validate that the daemon is still alive. Returns None if no daemon is running (file missing, stale, or unreachable).
discovery_file_path
Returns the path to the discovery file.
remove_discovery_file
Remove the discovery file (called during graceful shutdown).
resolve_port
Resolve the daemon health port from environment or default.
state_dir
Returns the directory used for daemon state files.
write_discovery_file
Write the discovery file atomically (write-to-temp then rename).