Expand description
Rivven Wire Protocol
This crate defines the wire protocol types shared between rivven-client and rivvend. It provides serialization/deserialization for all protocol messages.
§Wire Format
All messages use a unified wire format with format auto-detection and correlation ID:
┌─────────────────┬─────────────────┬──────────────────────────┬──────────────────────┐
│ Length (4 bytes)│ Format (1 byte) │ Correlation ID (4 bytes) │ Payload (N bytes) │
│ Big-endian u32 │ 0x00 = postcard │ Big-endian u32 │ Serialized message │
│ │ 0x01 = protobuf │ │ │
└─────────────────┴─────────────────┴──────────────────────────┴──────────────────────┘- postcard (0x00): High-performance Rust-native binary format
- protobuf (0x01): Cross-language format for Go, Java, Python clients
- correlation_id: Matches responses to their originating requests
§Protocol Stability
The enum variant order is significant for postcard serialization. Changes to variant order will break wire compatibility with existing clients/servers.
§Example
ⓘ
use rivven_protocol::{Request, Response, WireFormat};
// Serialize with format prefix
let request = Request::Ping;
let bytes = request.to_wire(WireFormat::Postcard, 1)?;
// Deserialize with auto-detection
let (response, format, correlation_id) = Response::from_wire(&bytes)?;Modules§
- serde_
utils - Serde utilities for bytes serialization
Structs§
- Batch
Record - A single record within a
Request::PublishBatch. - Broker
Info - Broker/node information for metadata discovery
- Delete
Records Result - Delete records result for a partition
- Message
Data - Serialized message data for transport
- Partition
Metadata - Partition metadata for cluster discovery
- Quota
Alteration - Quota alteration request
- Quota
Entry - Quota entry in describe response
- Topic
Config Description - Topic configuration in describe response
- Topic
Config Entry - Topic configuration entry for AlterTopicConfig
- Topic
Config Value - Topic configuration value with metadata
- Topic
Metadata - Topic metadata for cluster discovery
Enums§
- Protocol
Error - Protocol error types
- Request
- Protocol request messages
- Response
- Protocol response messages
- Schema
Type - Schema type (format) for schema registry
- Wire
Format - Wire format identifier
Constants§
- MAX_
AUTH_ PAYLOAD - Maximum authentication / SASL payload (64 KiB).
- MAX_
LIST_ LEN - Maximum number of items in a list field (topics, partitions, configs, etc.).
- MAX_
MESSAGES_ PER_ RESPONSE - Maximum number of messages in a single
Response::Messagesbatch. - MAX_
MESSAGE_ SIZE - Maximum message size (10 MiB)
- MAX_
NAME_ LEN - Maximum topic/group/entity name length (256 bytes).
- PROTOCOL_
VERSION - Protocol version for compatibility checking
- WIRE_
HEADER_ SIZE - Wire header size: format byte (1) + correlation_id (4)
Functions§
- is_
internal_ topic - Check whether a topic name designates an internal system topic.
Type Aliases§
- Result
- Result type for protocol operations
- Sync
Group Assignments - Partition assignments for SyncGroup:
Vec<(member_id, Vec<(topic, Vec<partition>)>)>