unifier-cli 0.5.0

Filesystem postbox for inter-process communication via a Unix tree
Documentation
//! Unix socket paths and daemon identity files.

use std::path::PathBuf;

use crate::home::UnifierHome;

const DAEMON_DIR: &str = ".daemon";

pub fn daemon_dir(home: &UnifierHome) -> PathBuf {
    home.path().join(DAEMON_DIR)
}

pub fn socket_path(home: &UnifierHome) -> PathBuf {
    daemon_dir(home).join("unifier.sock")
}

/// Outbound notices for mailbox/event wakeup (Jan cron listens here).
pub fn events_socket_path(home: &UnifierHome) -> PathBuf {
    daemon_dir(home).join("events.sock")
}

/// Inbound tick lifecycle control (Jan drives start/phase/end here).
///
/// Same line-delimited JSON as [`socket_path`], but only tick ops (+ ping)
/// are accepted. See [`crate::daemon::protocol::Request`] tick variants.
pub fn tick_socket_path(home: &UnifierHome) -> PathBuf {
    daemon_dir(home).join("tick.sock")
}

pub fn pid_path(home: &UnifierHome) -> PathBuf {
    daemon_dir(home).join("unifier.pid")
}

/// Temp static files served by the daemon HTTP listener.
pub fn www_dir(home: &UnifierHome) -> PathBuf {
    daemon_dir(home).join("www")
}

/// Bound localhost HTTP port (written when the web server starts).
pub fn http_port_path(home: &UnifierHome) -> PathBuf {
    daemon_dir(home).join("http.port")
}