Expand description
Confluent and Glue wire format encode/decode and auto-detection.
§Confluent Wire Format (Avro / JSON Schema)
The Confluent wire format prepends a 5-byte header to every serialized payload:
┌──────────┬────────────────────┬──────────────────┐
│ 0x00 (1B)│ Schema ID (4B, BE) │ Payload (N bytes)│
└──────────┴────────────────────┴──────────────────┘Use encode_wire_format() to frame and decode_wire_format() to
unframe.
§Confluent Wire Format (Protobuf)
For Protobuf schemas, a message-index array is inserted between the
5-byte header and the serialized bytes. The array encodes the path from the
.proto file root to the message type used:
┌──────────┬────────────────────┬─────────────────────────┬──────────────────┐
│ 0x00 (1B)│ Schema ID (4B, BE) │ Msg-index (varint array)│ Payload (N bytes)│
└──────────┴────────────────────┴─────────────────────────┴──────────────────┘The array is encoded as unsigned LEB-128 varints, with ZigZag encoding
applied to the signed message-index values. The first varint is the array
length; subsequent varints are the path segments. For a top-level message
type at index 0 (the most common case) the encoding is [0x01, 0x00]
(length=1, ZigZag(0)=0).
Use encode_protobuf_wire_format() to frame and
decode_protobuf_message_indexes() to strip and parse the index.
§AWS Glue Wire Format
The AWS Glue wire format uses an 18-byte header. See crate::glue for
the full specification.
Enums§
Functions§
- decode_
protobuf_ message_ indexes - Strip and parse the Protobuf message-index array from the raw bytes immediately after the 5-byte Confluent header.
- decode_
wire_ format - Decode a Confluent wire format message.
- decode_
wire_ format_ bytes - Decode a Confluent wire format message, returning a zero-copy
Bytespayload. - detect_
wire_ format - Detect schema wire format from the message header.
- encode_
protobuf_ wire_ format - Encode a Protobuf payload with the Confluent Protobuf wire format.
- encode_
wire_ format - Encode a payload with the Confluent wire format header.