Skip to main content

versioned_parts

Function versioned_parts 

Source
pub fn versioned_parts(key: &[u8]) -> Result<(&[u8], CommitTs), StorageError>
Expand description

Split a versioned key into its term prefix and commit timestamp without decoding any terms.

The commit timestamp is the trailing COMMIT_TS_LEN-byte descending big-endian suffix; the term prefix is everything before it, left as raw bytes. Callers that need decoded terms use decode_versioned_key (all slots) or decode specific slots themselves — this split exists so the per-key visibility checks can read the timestamp and compare logical-key bytes without paying a four-term parse per key.

A key shorter than COMMIT_TS_LEN is corruption and errors — it is never treated as “all timestamp, no terms”.