Skip to main content

running_process/broker/
mod.rs

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