Skip to main content

shep_core/protocol/
mod.rs

1//! The client<->daemon wire protocol (version 4)
2//!
3//! Typed request/response enums plus bus events. Framing lives in [`wire`];
4//! every type here is snapshot-pinned, so changing a serialized shape bumps
5//! [`PROTOCOL_VERSION`].
6//!
7//! Version 4 bumped on an addition, against the rule below. An older daemon
8//! cannot decode the new config requests, so the handshake must catch the
9//! skew.
10//!
11//! Two test-name conventions assert opposite things: a `*_wire_v4` snapshot
12//! pins the shape this crate serializes today, so it follows
13//! [`PROTOCOL_VERSION`] and gets renamed when that moves; a
14//! `v1_*_fixture_still_deserializes` test pins a literal payload from an old
15//! peer, and its name must never move since it records where the bytes
16//! came from.
17
18pub mod channel;
19pub mod events;
20pub mod frame;
21pub mod request;
22/// Frame encoding shared by daemon and client
23pub mod wire;
24
25pub use channel::{CHANNEL_VERSION, ChildMessage, ShepherdMessage};
26pub use events::{BusEvent, ProcessEventKind};
27pub use frame::ServerFrame;
28pub use request::{
29    ActionOutcome, ActionReply, DogSectionToml, DogSource, EnvValue, Envelope, ExitInfo, Hello,
30    HelloAck, HelloReply, Lamb, LineOutcome, LineReply, ProcessInfo, ProcessInfoBuilder, Reply,
31    Request, Response, RpcError, RpcErrorCode, SelectorSpec, SheepApplied, SheepConfigView,
32    SheepDrift, SignalOutcome, SignalReply, Smit, SmitError, sort_flock,
33};
34pub use wire::{MAX_FRAME_BYTES, WireError, codec, decode_frame, encode_frame};
35
36/// Wire protocol version.
37///
38/// Evolution rule: ADDITIVE optional fields (new serde-defaulted `Option<T>`
39/// fields, new variants behind `#[non_exhaustive]`) keep the version.
40/// Removing, renaming, or retyping anything serialized bumps it, recorded in
41/// the CHANGELOG. Byte fixtures in each protocol module pin the deserialize
42/// direction.
43pub const PROTOCOL_VERSION: u32 = 4;