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>,
pub startup_sink: Option<StartupEventSink>,
}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).
startup_sink: Option<StartupEventSink>Startup-stage telemetry sink — ReportStartupStageBegin/End
commands from the host are forwarded here (bypassing the
reducer entirely, see the match arm in handle_connection) so
they flow into the same splash-panel display as the launcher’s
own internal stages. None when the splash is disabled or on
platforms/paths that don’t yet wire a sink through (mirrors the
existing Option<StartupEventSink> plumbing in unix.rs/windows.rs).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ServerCtx
impl !UnwindSafe for ServerCtx
impl Freeze for ServerCtx
impl Send for ServerCtx
impl Sync for ServerCtx
impl Unpin for ServerCtx
impl UnsafeUnpin for ServerCtx
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.