rivven_protocol/lib.rs
1//! Rivven Wire Protocol
2//!
3//! This crate defines the wire protocol types shared between rivven-client and rivvend.
4//! It provides serialization/deserialization for all protocol messages.
5//!
6//! # Protocol Stability
7//!
8//! The enum variant order is significant for postcard serialization. Changes to variant
9//! order will break wire compatibility with existing clients/servers.
10//!
11//! # Example
12//!
13//! ```rust,ignore
14//! use rivven_protocol::{Request, Response};
15//!
16//! // Serialize a request
17//! let request = Request::Ping;
18//! let bytes = request.to_bytes()?;
19//!
20//! // Deserialize a response
21//! let response = Response::from_bytes(&bytes)?;
22//! ```
23
24mod error;
25mod messages;
26mod metadata;
27mod types;
28
29pub use error::{ProtocolError, Result};
30pub use messages::{
31 DeleteRecordsResult, QuotaAlteration, QuotaEntry, Request, Response, TopicConfigDescription,
32 TopicConfigEntry, TopicConfigValue,
33};
34pub use metadata::{BrokerInfo, PartitionMetadata, TopicMetadata};
35pub use types::MessageData;
36
37/// Protocol version for compatibility checking
38pub const PROTOCOL_VERSION: u32 = 1;
39
40/// Maximum message size (64 MiB)
41pub const MAX_MESSAGE_SIZE: usize = 64 * 1024 * 1024;