Skip to main content

frame_offset

Function frame_offset 

Source
pub fn frame_offset(frame_index: u64, frame_size: usize) -> u64
Expand description

Byte offset of the frame at index frame_index (0-based, where 0 is the first frame after the WAL header).

Power-of-ten Rule 7: frame_index is caller-controlled (this is a pub helper used by tests and by external WAL inspection utilities). Saturate at u64::MAX on overflow rather than panicking — every production caller passes an index bounded by committed_frames, but a fuzz / forensic caller could pass an arbitrarily-large index and overflow-checks = true (Rule 10) would otherwise turn the multiply into a panic.

Phase 4 (issue #9): frame_size is the on-disk per-frame stride (4160 for unencrypted WALs, 4188 for encrypted ones). Use frame_size_for to pick the right value.