1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//! v1 broker module — schemas are FROZEN FOREVER once v1.0 ships.
//!
//! Phase 0 of #228: this module exposes the prost-generated wire types
//! (envelope, manifest, service definition) for every later phase to
//! depend on. No consumers ship yet — Phases 1+ wire them in.
//!
//! See `proto/broker_v1_*.proto` and the parent issue for the rationale
//! behind every field number and `reserved` range.
pub
/// Framing byte for every v1 broker connection. Wire layout:
/// `[u8 framing_version=1][u32 LE body_length][prost body]`.
///
/// THIS BYTE is the truly-frozen-forever invariant — see #228
/// "Frozen-forever commitments" section. A v2 client connecting to a
/// v1 broker writes `[1][len][v2-shaped Hello]`; the v1 broker reads
/// the framing byte and decides whether to decode or `Refused` with
/// `ERROR_VERSION_UNSUPPORTED`.
pub const FRAMING_VERSION_V1: u8 = 1;
/// Hard ceiling on any single broker frame. Broker disconnects on
/// overflow. See #228 "Wire-level commitments".
pub const MAX_FRAME_SIZE_BYTES: usize = 16 * 1024 * 1024;
/// Hard ceiling on the Hello envelope specifically. Broker returns
/// `Refused` on overflow. See #228 "Wire-level commitments".
pub const MAX_HELLO_SIZE_BYTES: usize = 64 * 1024;
/// Upper bound on a LifecycleEvent's prost-encoded size, set to the
/// minimum POSIX `PIPE_BUF` so atomic-append into the event log is
/// guaranteed on every platform. Linux raises this to 4096 in practice,
/// but the cross-platform floor is 512.
pub const LIFECYCLE_EVENT_PIPE_BUF_FLOOR: usize = 512;