Skip to main content

shep_core/protocol/
mod.rs

1//! The client<->daemon wire protocol (version 1)
2//!
3//! Typed request/response enums + bus events. Framing lives in [`wire`];
4//! every type here is snapshot-pinned — changing any serialized shape is a
5//! protocol version bump recorded in the CHANGELOG.
6
7pub mod channel;
8pub mod events;
9pub mod frame;
10pub mod request;
11/// Frame encoding shared by daemon and client
12pub mod wire;
13
14pub use channel::{CHANNEL_VERSION, ChildMessage, ShepherdMessage};
15pub use events::{BusEvent, ProcessEventKind};
16pub use frame::ServerFrame;
17pub use request::{
18    ActionOutcome, ActionReply, DogSectionToml, DogSource, Envelope, ExitInfo, Hello, HelloAck,
19    HelloReply, Lamb, LineOutcome, LineReply, ProcessInfo, ProcessInfoBuilder, Reply, Request,
20    Response, RpcError, RpcErrorCode, SelectorSpec, SheepDrift, SignalOutcome, SignalReply, Smit,
21    SmitError, sort_flock,
22};
23pub use wire::{MAX_FRAME_BYTES, WireError, codec, decode_frame, encode_frame};
24
25/// Wire protocol version.
26///
27/// Evolution rule: ADDITIVE optional fields (new serde-defaulted `Option<T>`
28/// fields, new variants behind `#[non_exhaustive]`) keep the version.
29/// Removing, renaming, or retyping anything serialized bumps it, recorded in
30/// the CHANGELOG. Byte fixtures in each protocol module pin the deserialize
31/// direction. Phase 2b additions: [`ServerFrame`] (untagged decode helper) and
32/// [`RpcErrorCode::DeadlineExceeded`] are both additive. Phase 3 addition:
33/// [`ProcessInfo`]'s `out_file`/`err_file`, also additive — they decode to
34/// `None` from pre-Phase-3 bytes, and a pre-Phase-3 peer ignores them.
35pub const PROTOCOL_VERSION: u32 = 1;