Skip to main content

Keys

Trait Keys 

Source
pub trait Keys {
    // Required methods
    fn hash_at(&self, addr: Addr) -> u64;
    fn eq_at(&self, addr: Addr, key: &[u8]) -> bool;
}
Expand description

What the index needs to know about the records its addresses point at.

The index stores a tag and an address, not a key and not a hash. A split has to recompute which side of the next bit each entry falls on, and a probe has to confirm a tag match, so both need to reach the key bytes. Keeping that behind a trait is what lets the index stay independent of the record format, which changes in M1 and again when documents arrive.

Required Methods§

Source

fn hash_at(&self, addr: Addr) -> u64

The full hash of the key stored at addr.

Source

fn eq_at(&self, addr: Addr, key: &[u8]) -> bool

Whether the key stored at addr is key.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§