Skip to main content

Module index

Module index 

Source
Expand description

Decoders for the Kafka-format index and log bytes that a remote segment carries.

The copy path writes a segment’s .index, .timeindex, and .txnindex verbatim, so these decoders mirror the on-disk layouts that krabka_log::index::{OffsetIndex, TimeIndex} and krabka_log::txn_index::TxnIndex wrote locally.

Every decoder here returns a RemoteStorageError on malformed input and never panics. The bytes arrive from an object store, which can return truncated or corrupt data, so a panic would be a denial-of-service surface on the read path.

One submodule per on-disk artifact: offset for the .index layout and the byte range a fetch derives from it, time for the .timeindex layout and its timestamp floor, txn for the .txnindex layout and its range-overlap test, and batch for the scans over the .log bytes those sparse indexes can only point near. The offset vocabulary and the two error constructors they share stay here.

Structs§

AbortedTxnIndexEntry
One 34-byte aborted-transaction index entry.
OffsetIndexEntry
8 bytes per entry: rel u32 BE, then pos u32 BE.
TimeIndexEntry
12 bytes per entry: ts i64 BE, then rel u32 BE. It mirrors krabka_log::index::TimeEntryRaw.

Functions§

corrupt_log
Wraps a decode failure on a remote segment’s .log bytes.
end_position_for
Computes the inclusive end_position for a remote byte-range fetch.
first_batch_at_or_after
Decodes batches from data and returns the first one whose last offset is >= floor.
first_record_at_or_after_timestamp
Decodes remote log batches and returns the earliest record at or after both floor_offset and target_timestamp.
parse_offset_index
Borrows Kafka’s OffsetIndex on-disk format as a zero-copy &[OffsetIndexEntry].
parse_time_index
Borrows Kafka’s TimeIndex on-disk format as a zero-copy &[TimeIndexEntry].
parse_txn_index
Borrows Kafka’s transaction-index format as a zero-copy &[AbortedTxnIndexEntry].
position_for_relative_offset
Floor lookup: the byte position of the largest entry with rel <= target_rel.
relative_offset_floor_for_timestamp
Returns a safe relative-offset floor for an exact timestamp scan.
txn_overlaps
Reports whether an aborted-transaction entry overlaps the inclusive offset range [from_offset, to_offset].

Type Aliases§

BytePosition
Byte position within a segment’s .log file. This is the offset-index value.
LogOffset
Absolute (partition-level) log offset.
RelativeOffset
Offset relative to a segment’s base offset. This is the offset-index key.
TimestampMs
Record timestamp in milliseconds since the Unix epoch.