Skip to main content

Module paths

Module paths 

Source
Expand description

Filesystem path helpers for the daemon and its clients.

Both the daemon and the CLI-side dialer need to agree on where the socket and state file live; isolating the logic here means a future move (e.g. /var/run/zero/<operator>.sock on Linux) is a single-file change instead of a grep-and-replace.

The defaults land under zero_config::runtime_paths. We intentionally do not put the socket under XDG_RUNTIME_DIR on Linux, because that directory is lost across login sessions and the daemon’s whole purpose is surviving the operator’s terminal.

Constants§

SOCKET_FILE_NAME
Socket file name under the operator directory.
STATE_FILE_NAME
STATE_SUBDIR
State-file path relative to the operator directory. state/headless.json keeps daemon persistence under the same operator partition as session state and wraps.

Functions§

default_socket_path
Default Unix socket path: <zero_dir>/operators/<operator-slug>/sock. Falls back to <tmpdir>/zero-sock when config paths are unavailable.
default_state_path
Default state-file path: <zero_dir>/operators/<operator-slug>/state/headless.json.
socket_in
Socket path rooted at an arbitrary base — used by tests to point both the daemon and its dialer at a temp dir.
state_in
State-file path rooted at an arbitrary base. Mirrors the production layout so tests exercise the same state/headless.json resolution as prod.