Expand description
Wire protocol types and codec for the Iggy binary protocol.
This crate is the single source of truth for the binary wire format shared between the Iggy server and SDK. It is a pure codec - no I/O, no async, no runtime dependencies.
§Design
Protocol types are independent from domain types. Conversion between wire types and domain types happens at the boundary (SDK client impls, server handlers).
§Wire frame format
Request (client -> server):
[length:4 bytes, u32 LE][code:4 bytes, u32 LE][payload:N bytes]Response (server -> client):
[status:4 bytes, u32 LE][length:4 bytes, u32 LE][payload:N bytes]All multi-byte integers are little-endian. Strings are length-prefixed (u8 length for names, u32 length for longer strings).
§VSR consensus framing
All consensus headers are 256 bytes with #[repr(C)] layout.
Deserialization is zero-copy via bytemuck. Runtime message wrappers
(Message, MessageBag, backings) live in server_common; this crate
exposes only the wire-level header types.
- Client-facing:
RequestHeader,ReplyHeader - Replication:
PrepareHeader,PrepareOkHeader,CommitHeader - View change:
StartViewChangeHeader,DoViewChangeHeader,StartViewHeader - Dispatch:
GenericHeaderfor type-erased initial parsing
Re-exports§
pub use codec::WireDecode;pub use codec::WireEncode;pub use consensus::CHECKSUM_UNSEALED;pub use consensus::Command;pub use consensus::CommitHeader;pub use consensus::ConsensusError;pub use consensus::ConsensusHeader;pub use consensus::ConsumerSession;pub use consensus::ConsumerSessionHeartbeatHeader;pub use consensus::DVC_HEADERS_MAX;pub use consensus::DoViewChangeHeader;pub use consensus::EvictionHeader;pub use consensus::EvictionReason;pub use consensus::ForwardCompletionHeader;pub use consensus::ForwardLogoutHeader;pub use consensus::ForwardLogoutOutcome;pub use consensus::ForwardLogoutResultHeader;pub use consensus::ForwardRegisterHeader;pub use consensus::ForwardRegisterOutcome;pub use consensus::ForwardRegisterResultHeader;pub use consensus::GenericHeader;pub use consensus::HEADER_SIZE;pub use consensus::LIFECYCLE_BATCH_HEADER_SIZE;pub use consensus::LIFECYCLE_COMPLETION_SIZE;pub use consensus::LIFECYCLE_COMPLETIONS_MAX;pub use consensus::MAX_CONSUMER_SESSIONS_PER_HEARTBEAT;pub use consensus::Operation;pub use consensus::PrepareHeader;pub use consensus::PrepareOkHeader;pub use consensus::PrimaryRebalanceHeader;pub use consensus::PrimaryRebalanceKind;pub use consensus::REJECTION_SECTION_LEN;pub use consensus::RESERVED_COMMAND_LEN;pub use consensus::RepairPrepareHeader;pub use consensus::RepairRangeReplyHeader;pub use consensus::ReplyHeader;pub use consensus::RequestHeader;pub use consensus::RequestPreparesHeader;pub use consensus::RequestStartViewHeader;pub use consensus::RequestStateChunkHeader;pub use consensus::RequestStateTransferHeader;pub use consensus::RoutedRequestHeader;pub use consensus::SIZE_FIELD_OFFSET;pub use consensus::SegmentDeleteHeader;pub use consensus::SegmentDeleteKind;pub use consensus::StartViewChangeHeader;pub use consensus::StartViewHeader;pub use consensus::StateChunkHeader;pub use consensus::StateTransferTargetHeader;pub use consensus::frame_body;pub use consensus::frame_checksum_bytes;pub use consensus::prepare_identity_checksum_bytes;pub use consensus::read_size_field;pub use consensus::result_code;pub use consensus::result_section_len;pub use consensus::write_rejection_section;pub use dispatch::COMMAND_TABLE;pub use dispatch::CommandMeta;pub use dispatch::lookup_by_operation;pub use dispatch::lookup_command;pub use error::WireError;pub use framing::RequestFrame;pub use framing::ResponseFrame;pub use framing::STATUS_OK;pub use primitives::ack_level::AckLevel;pub use primitives::consumer::KIND_CONSUMER;pub use primitives::consumer::KIND_CONSUMER_GROUP;pub use primitives::consumer::KIND_EXTERNAL_GROUP;pub use primitives::consumer::WireConsumer;pub use primitives::identifier::MAX_WIRE_NAME_LENGTH;pub use primitives::identifier::WireIdentifier;pub use primitives::identifier::WireName;pub use primitives::options::MAX_OPTIONS;pub use primitives::options::MAX_OPTIONS_BYTES;pub use primitives::options::WireOptions;pub use primitives::options::validate_options;pub use primitives::partition_assignment::CreatedPartitionAssignment;pub use primitives::partition_history::ConsumerGroupOwner;pub use primitives::partition_history::PartitionContext;pub use primitives::partitioning::MAX_MESSAGES_KEY_LENGTH;pub use primitives::partitioning::WirePartitioning;pub use primitives::permissions::WireGlobalPermissions;pub use primitives::permissions::WirePermissions;pub use primitives::permissions::WireStreamPermissions;pub use primitives::permissions::WireTopicPermissions;pub use primitives::polling_strategy::WirePollingStrategy;pub use primitives::user_headers::WireHeaderKind;pub use primitives::user_headers::WireUserHeaderEntry;pub use primitives::user_headers::WireUserHeaderIterator;pub use primitives::user_headers::WireUserHeaders;pub use primitives::user_headers::encode_user_headers;pub use primitives::user_headers::user_headers_encoded_size;pub use primitives::user_headers::validate_user_headers;pub use version::ClientVersionInfo;pub use version::IGGY_PROTOCOL_VERSION;pub use version::IGGY_PROTOCOL_VERSION_MIN;pub use version::ProtocolVersion;pub use version::is_protocol_compatible;
Modules§
- batch
- The message batch: the one layout a
SendMessagesbody, the replicated prepare, the persisted segment record, and the poll reply all share. - codec
- codes
- consensus
- VSR (Viewstamped Replication) consensus wire types.
- dispatch
- Command dispatch table mapping codes and operations to metadata.
- error
- framing
- Sans-IO frame codec for the Iggy binary protocol.
- namespace
- Consensus group-id packing constants.
- primitives
- Shared wire primitives reused across request and response types.
- requests
- responses
- version
- Binary protocol versioning.
Constants§
- MAX_
PARTITIONS_ PER_ REQUEST - Maximum number of partitions allowed in a single create/delete request.