Expand description
MemtableSkipList: lock-free sorted map keyed by encoded InternalKey bytes.
We use crossbeam_skiplist::SkipMap<bytes::Bytes, EntryValue>.
Keys are the raw wire bytes of InternalKey, which sort correctly via
bytes::Bytes’s lexicographic Ord implementation (guaranteed by the
InternalKey encoding — see merutable-types/src/key.rs).
§Point lookup algorithm
Given user_key_bytes (the PK-encoded portion, without tag) and read_seq:
- Build a
seek_bytes=user_key_bytes ++ seek_tag(SEQNUM_MAX). This is the lexicographically smallest InternalKey for that PK (tag = 0x0000000000000001). map.lower_bound(Included(&seek_bytes))→ first entry ≥ seek key.- Verify entry’s PK prefix matches
user_key_bytes. - Decode
seqfrom the entry’s tag; reject ifseq > read_seq. - Return
Some(entry.value())orNone.
Structs§
- Entry
Value - Value stored in the skip list.
- Memtable
Skip List
Functions§
- decode_
op_ type_ from_ key - Decode the
OpTypefrom a fully encoded InternalKey bytes slice. - decode_
seq_ from_ key - Decode the sequence number from a fully encoded InternalKey bytes slice.
The tag occupies the last 8 bytes in big-endian:
(inverted_seq << 8) | op_type. - user_
key_ of - Extract user-key (PK) bytes from a fully encoded InternalKey bytes slice.