pub struct NodeClient { /* private fields */ }Expand description
One local ACP node: a single OpenedStore, its push link, and an
optional send socket for m4a-send.
Implementations§
Source§impl NodeClient
impl NodeClient
Sourcepub fn from_env() -> Result<Self, ShellError>
pub fn from_env() -> Result<Self, ShellError>
Open from the process environment: refuse webhook env, require the
leader named by LEADER_SOCK_ENV to be listening, register + first
key drive, open the push socket. Does not start grok and does not
invent a leader. On Windows the path is only what grok hashes into
a named pipe; the file does not have to exist.
Sourcepub fn session_id(&self) -> &str
pub fn session_id(&self) -> &str
Session id used for ACP sessionId.
Sourcepub fn store_root(&self) -> &Path
pub fn store_root(&self) -> &Path
Store root this client seals under.
Sourcepub fn store(&self) -> &OpenedStore
pub fn store(&self) -> &OpenedStore
Underlying sealed store (for tests and advanced callers).
Sourcepub fn store_mut(&mut self) -> &mut OpenedStore
pub fn store_mut(&mut self) -> &mut OpenedStore
Mutable underlying store.
Sourcepub fn wake_log(&self) -> &[WakeAttempt]
pub fn wake_log(&self) -> &[WakeAttempt]
Routine wake attempts since open (event id + HTTP status). Empty on the node path because webhook wake is refused.
Sourcepub fn listen_for_sends(&mut self, path: &Path) -> Result<(), ShellError>
pub fn listen_for_sends(&mut self, path: &Path) -> Result<(), ShellError>
Listen for m4a-send on path. Replaces a stale socket file and
refuses when another live client already holds it. Unix is a mode
0600 domain socket. Windows writes 127.0.0.1:{port} and listens
on that loopback port.
Sourcepub fn listen_for_sends_from_env(&mut self) -> Result<PathBuf, ShellError>
pub fn listen_for_sends_from_env(&mut self) -> Result<PathBuf, ShellError>
Self::listen_for_sends on crate::SEND_SOCK_ENV, or
NODE_DEFAULT_SOCK_NAME under the store root.
Sourcepub fn tick(&mut self, now_ms: i64, full_drive_secs: u64) -> NodeTickReport
pub fn tick(&mut self, now_ms: i64, full_drive_secs: u64) -> NodeTickReport
One step of the long-running node loop.
Drains the push socket, drives the session (waiting on /sync when
a push arrived so decrypt + ACP wake can run), accepts DM invites,
and answers queued m4a-send requests. Every full_drive_secs a
catch-up drive runs even without a push.