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