Skip to main content

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;
27pub mod serde_utils;
28mod types;
29
30pub use error::{ProtocolError, Result};
31pub use messages::{
32    DeleteRecordsResult, QuotaAlteration, QuotaEntry, Request, Response, TopicConfigDescription,
33    TopicConfigEntry, TopicConfigValue,
34};
35pub use metadata::{BrokerInfo, PartitionMetadata, TopicMetadata};
36pub use types::{MessageData, SchemaType};
37
38/// Protocol version for compatibility checking
39pub const PROTOCOL_VERSION: u32 = 1;
40
41/// Maximum message size (64 MiB)
42pub const MAX_MESSAGE_SIZE: usize = 64 * 1024 * 1024;