Skip to main content

NodeClient

Struct NodeClient 

Source
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

Source

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.

Source

pub fn nick(&self) -> Option<&str>

Derived nick of the one session, when register stored one.

Source

pub fn session_id(&self) -> &str

Session id used for ACP sessionId.

Source

pub fn user_id(&self) -> &str

Matrix user id of the open session.

Source

pub fn store_root(&self) -> &Path

Store root this client seals under.

Source

pub fn store(&self) -> &OpenedStore

Underlying sealed store (for tests and advanced callers).

Source

pub fn store_mut(&mut self) -> &mut OpenedStore

Mutable underlying store.

Source

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.

Source

pub fn wake_note(&self) -> Option<&str>

Last wake failure note (ACP errors), if any.

Source

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.

Source

pub fn listen_for_sends_from_env(&mut self) -> Result<PathBuf, ShellError>

Source

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.

Source

pub fn send_blocking( &mut self, to: &str, text: &str, wait: Duration, ) -> SendReply

Blocking send from this node’s nick to to (encrypted DM). Used when m4a-send falls through with no socket answer, or by callers that already hold the client.

Trait Implementations§

Source§

impl Drop for NodeClient

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> JsonCastable<CanonicalJsonValue> for T

Source§

impl<T> JsonCastable<Value> for T

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more