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§
- Aborted
TxnIndex Entry - One 34-byte aborted-transaction index entry.
- Offset
Index Entry - 8 bytes per entry: rel u32 BE, then pos u32 BE.
- Time
Index Entry - 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
.logbytes. - end_
position_ for - Computes the inclusive
end_positionfor a remote byte-range fetch. - first_
batch_ at_ or_ after - Decodes batches from
dataand 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_offsetandtarget_timestamp. - parse_
offset_ index - Borrows Kafka’s
OffsetIndexon-disk format as a zero-copy&[OffsetIndexEntry]. - parse_
time_ index - Borrows Kafka’s
TimeIndexon-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§
- Byte
Position - Byte position within a segment’s
.logfile. This is the offset-index value. - LogOffset
- Absolute (partition-level) log offset.
- Relative
Offset - Offset relative to a segment’s base offset. This is the offset-index key.
- Timestamp
Ms - Record timestamp in milliseconds since the Unix epoch.