Skip to main content

weir_core/
lib.rs

1//! Core wire-protocol types shared by the weir daemon, client, and sink SDK.
2//!
3//! `weir-core` is the dependency-light foundation of the weir workspace: it
4//! defines the v1 binary frame format and nothing else (no I/O, no async, no
5//! daemon logic). Everything that crosses the socket is built from these types.
6//!
7//! # What's here
8//!
9//! - [`Envelope`] / [`Header`] — a complete wire frame and its 16-byte header,
10//!   with `encode`/`decode` that own the CRC and validation order.
11//! - [`MessageType`] / [`Durability`] / [`NackReason`] — the fixed-repr enums
12//!   carried in the header and Nack payloads, each with a `TryFrom<u8>` whose
13//!   error is [`UnknownMessageType`] / [`UnknownDurability`] / [`UnknownNackReason`]
14//!   (re-exported here alongside the enums).
15//! - [`RecordCoordinate`] — where an accepted record landed in the WAB, carried
16//!   back by an [`AckTracked`](MessageType::AckTracked) frame.
17//! - [`Payload`] — opaque, ref-counted payload bytes (O(1) clone).
18//! - [`DecodeError`] / [`WeirError`] — the decode failure taxonomy.
19//! - [`WIRE_VERSION`] / [`MAX_PAYLOAD_HARD_CAP`] / [`HEADER_LEN`] /
20//!   [`MIN_FRAME_LEN`] — the protocol constants.
21//!
22//! The wire format itself is specified in `docs/wire_protocol.md`; this crate
23//! is its executable reference (see `tests/reference_frames.rs`).
24#![deny(missing_docs)]
25
26pub mod coordinate;
27pub mod durability;
28pub mod envelope;
29pub mod error;
30pub mod nack;
31pub mod payload;
32pub mod version;
33
34pub use coordinate::{
35    COORDINATE_FIXED_LEN, COORDINATE_VERSION, CoordinateError, MAX_SEGMENT_NAME_LEN,
36    MAX_TRACKED_ACK_PAYLOAD_LEN, RecordCoordinate,
37};
38pub use durability::{Durability, UnknownDurability};
39pub use envelope::{Envelope, HEADER_LEN, Header, MIN_FRAME_LEN, MessageType, UnknownMessageType};
40pub use error::{DecodeError, WeirError};
41pub use nack::{NackReason, UnknownNackReason};
42pub use payload::Payload;
43pub use version::{MAX_PAYLOAD_HARD_CAP, WIRE_VERSION};