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, SignalOutcome, SignalReply,
21};
22pub use wire::{MAX_FRAME_BYTES, WireError, codec, decode_frame, encode_frame};
23
24/// Wire protocol version.
25///
26/// Evolution rule: ADDITIVE optional fields (new serde-defaulted `Option<T>`
27/// fields, new variants behind `#[non_exhaustive]`) keep the version.
28/// Removing, renaming, or retyping anything serialized bumps it, recorded in
29/// the CHANGELOG. Byte fixtures in each protocol module pin the deserialize
30/// direction. Phase 2b additions: [`ServerFrame`] (untagged decode helper) and
31/// [`RpcErrorCode::DeadlineExceeded`] are both additive. Phase 3 addition:
32/// [`ProcessInfo`]'s `out_file`/`err_file`, also additive — they decode to
33/// `None` from pre-Phase-3 bytes, and a pre-Phase-3 peer ignores them.
34pub const PROTOCOL_VERSION: u32 = 1;