Skip to main content

Module protocol

Module protocol 

Source
Expand description

The client<->daemon wire protocol (version 4)

Typed request/response enums plus bus events. Framing lives in wire; every type here is snapshot-pinned, so changing a serialized shape bumps PROTOCOL_VERSION.

Version 4 bumped on an addition, against the rule below. An older daemon cannot decode the new config requests, so the handshake must catch the skew.

Two test-name conventions assert opposite things: a *_wire_v4 snapshot pins the shape this crate serializes today, so it follows PROTOCOL_VERSION and gets renamed when that moves; a v1_*_fixture_still_deserializes test pins a literal payload from an old peer, and its name must never move since it records where the bytes came from.

Re-exports§

pub use channel::CHANNEL_VERSION;
pub use channel::ChildMessage;
pub use channel::ShepherdMessage;
pub use events::BusEvent;
pub use events::ProcessEventKind;
pub use frame::ServerFrame;
pub use request::ActionOutcome;
pub use request::ActionReply;
pub use request::DogSectionToml;
pub use request::DogSource;
pub use request::EnvValue;
pub use request::Envelope;
pub use request::ExitInfo;
pub use request::Hello;
pub use request::HelloAck;
pub use request::HelloReply;
pub use request::Lamb;
pub use request::LineOutcome;
pub use request::LineReply;
pub use request::ProcessInfo;
pub use request::ProcessInfoBuilder;
pub use request::Reply;
pub use request::Request;
pub use request::Response;
pub use request::RpcError;
pub use request::RpcErrorCode;
pub use request::SelectorSpec;
pub use request::SheepApplied;
pub use request::SheepConfigView;
pub use request::SheepDrift;
pub use request::SignalOutcome;
pub use request::SignalReply;
pub use request::Smit;
pub use request::SmitError;
pub use request::sort_flock;
pub use wire::MAX_FRAME_BYTES;
pub use wire::WireError;
pub use wire::codec;
pub use wire::decode_frame;
pub use wire::encode_frame;

Modules§

channel
The shepherd channel: newline-JSON wire on fd 3 between the shepherd and each spawned child. ChildMessage flows child -> shepherd; ShepherdMessage flows shepherd -> child. Framing is wired by shep-daemon; lives in shep-core because BusEvent::Channel carries a ChildMessage verbatim to every bus subscriber.
events
Bus events broadcast to subscribed clients
frame
Anything the daemon writes to a connected client
request
RPC frames: requests, responses, envelopes, and structured errors
wire
Frame encoding shared by daemon and client Frame encoding: u32 length prefix + JSON payload

Constants§

PROTOCOL_VERSION
Wire protocol version.