ServerCtx

Struct ServerCtx 

Source
pub struct ServerCtx {
    pub launcher_pid: u32,
    pub launcher_version: String,
    pub state: Arc<Mutex<State>>,
    pub events_tx: Sender<Event>,
    pub event_log: Arc<EventLog>,
    pub host_pipe: Arc<HostPipe>,
}
Expand description

State the IPC server shares across connections. Carries the launcher’s identity (for patching into Registered events the reducer emits with sentinel values) plus the canonical State.

Fields§

§launcher_pid: u32§launcher_version: String§state: Arc<Mutex<State>>

Canonical state owned by the server. Mutex held only during reducer dispatch — sub-millisecond.

Phase E.1a — moved from Mutex<State> to Arc<Mutex<State>> so the saga coordinator can share access. The coordinator needs bump_version when emitting saga lifecycle events and will (in E.5) inspect state during saga decisions. Sharing via Arc keeps the existing single-writer-mutex discipline.

§events_tx: Sender<Event>

Phase B.8 — broadcast bus for reducer-emitted events. Every reducer event from reducer::update is published here; each connection subscribes and writes received events to its own pipe. Lets observability clients (--diag wrr, future Tools) see cross-process activity, not just replies to their own commands. Per-connection direct sends (Error replies for parse failures, register-first violations) bypass the bus — they’re response-to-this-client-only by intent. (codex P1 PR #605.)

§event_log: Arc<EventLog>

Phase D.2 — event log: in-memory ring of recent reducer events (replay source for D.3’s GetEvents) + disk persistence stream for crash forensics. Server appends to the in-memory ring synchronously after each reducer dispatch; the disk writer is a separate task spawned in main.rs that subscribes to the broadcast bus.

§host_pipe: Arc<HostPipe>

CPD-2 — launcher → host pipe wrapper. The per-connection handler hands the host’s writer half to HostPipe::set_writer once the connecting client registers as ClientKind::Host, and clears it on disconnect. The host’s per-connection event fanout task routes events through HostPipe::send_event instead of send_event direct (so frames carry the HostFrame envelope and traverse the pending-buffer path when the host reconnects).

Trait Implementations§

Source§

impl Debug for ServerCtx

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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