Package org.apache.kafka.streams.state
Interface HeadersBytesStore
public interface HeadersBytesStore
Marker interface to indicate that a bytes store understands the value-with-headers format
and can convert legacy timestamped value entries (ValueAndTimestamp format) to the new format.
This is analogous to TimestampedBytesStore but for header-aware stores.
Per KIP-1271, the value format is: [headersSize(varint)][headersBytes][payloadBytes] where payloadBytes is the existing serialized value (e.g., [timestamp(8)][value] for timestamped stores).
-
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic byte[]convertFromPlainToHeaderFormat(byte[] value) static byte[]convertToHeaderFormat(byte[] value) Converts a legacy value (without headers) to the header-embedded format by adding empty headers prefix.
-
Method Details
-
convertToHeaderFormat
static byte[] convertToHeaderFormat(byte[] value) Converts a legacy value (without headers) to the header-embedded format by adding empty headers prefix.This is a general-purpose method that prepends an empty headers prefix to any byte array. The header-embedded format is: [headersSize(varint)][headersBytes][payload] where empty headers are represented as headersSize=0 (encoded as [0x00]).
Usage examples:
- Timestamped stores: [timestamp(8)][value] → [0x00][timestamp(8)][value]
- Window stores: [value] → [0x00][value]
- Parameters:
value- the legacy value bytes (may include timestamp for timestamped stores, or plain value for window stores)- Returns:
- the value in header-embedded format with empty headers prefix [0x00][value]
-
convertFromPlainToHeaderFormat
static byte[] convertFromPlainToHeaderFormat(byte[] value)
-