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
4//! [`wire`]; a serialized shape change bumps [`PROTOCOL_VERSION`].
5//! Version 4 bumped on an addition. An older daemon cannot decode the
6//! new config requests, so the handshake catches the skew.
7//!
8//! A `*_wire_v4` test pins today's shape. A
9//! `v1_*_fixture_still_deserializes` test pins an old peer's payload and
10//! never renames.
11
12pub mod events;
13pub mod frame;
14pub mod request;
15/// Frame encoding shared by daemon and client
16pub mod wire;
17
18pub use events::{BusEvent, ProcessEventKind};
19pub use frame::ServerFrame;
20pub use request::{
21    ActionOutcome, ActionReply, DogSectionToml, DogSource, EnvValue, Envelope, ExitInfo, Hello,
22    HelloAck, HelloReply, Lamb, LineOutcome, LineReply, ProcessInfo, ProcessInfoBuilder, Reply,
23    Request, Response, RpcError, RpcErrorCode, SelectorSpec, SheepApplied, SheepConfigView,
24    SheepDrift, SignalOutcome, SignalReply, Smit, SmitError, sort_flock,
25};
26pub use shep_channel::{CHANNEL_VERSION, ChildMessage, ShepherdMessage};
27pub use wire::{MAX_FRAME_BYTES, WireError, codec, decode_frame, encode_frame};
28
29/// The shepherd channel's wire types. Moved to the `shep-channel` crate;
30/// this path is kept so consumers of 0.1.x do not break. Use
31/// `shep_core::protocol` directly instead.
32#[deprecated(note = "use `shep_core::protocol` directly")]
33pub mod channel {
34    pub use shep_channel::{CHANNEL_VERSION, ChildMessage, ShepherdMessage};
35}
36
37/// Wire protocol version.
38///
39/// Additive optional fields (new serde-defaulted `Option<T>` fields, new
40/// variants behind `#[non_exhaustive]`) keep the version. Removing,
41/// renaming, or retyping anything serialized bumps it, recorded in the
42/// CHANGELOG. Byte fixtures in each protocol module pin the deserialize
43/// direction.
44pub const PROTOCOL_VERSION: u32 = 4;