Skip to main content

Crate rivven_protocol

Crate rivven_protocol 

Source
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:

┌─────────────────┬─────────────────┬──────────────────────────────┐
│ Length (4 bytes)│ Format (1 byte) │ Payload (N bytes)            │
│ Big-endian u32  │ 0x00 = postcard │ Serialized message           │
│                 │ 0x01 = protobuf │                              │
└─────────────────┴─────────────────┴──────────────────────────────┘
  • postcard (0x00): High-performance Rust-native binary format
  • protobuf (0x01): Cross-language format for Go, Java, Python clients

§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)?;

// Deserialize with auto-detection
let (response, format) = Response::from_wire(&bytes)?;

Modules§

serde_utils
Serde utilities for bytes serialization

Structs§

BrokerInfo
Broker/node information for metadata discovery
DeleteRecordsResult
Delete records result for a partition
MessageData
Serialized message data for transport
PartitionMetadata
Partition metadata for cluster discovery
QuotaAlteration
Quota alteration request
QuotaEntry
Quota entry in describe response
TopicConfigDescription
Topic configuration in describe response
TopicConfigEntry
Topic configuration entry for AlterTopicConfig
TopicConfigValue
Topic configuration value with metadata
TopicMetadata
Topic metadata for cluster discovery

Enums§

ProtocolError
Protocol error types
Request
Protocol request messages
Response
Protocol response messages
SchemaType
Schema type (format) for schema registry
WireFormat
Wire format identifier

Constants§

MAX_MESSAGE_SIZE
Maximum message size (64 MiB)
PROTOCOL_VERSION
Protocol version for compatibility checking

Type Aliases§

Result
Result type for protocol operations