Index

Trait Index 

Source
pub trait Index: Send + Sync {
    // Required methods
    fn insert(&mut self, key: &[u8], value: u64) -> Result<()>;
    fn find(&self, key: &[u8]) -> Result<Vec<u64>>;
    fn remove(&mut self, key: &[u8]) -> Result<bool>;
    fn len(&self) -> usize;
    fn clear(&mut self);
    fn index_type(&self) -> IndexType;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

Index trait defining the common interface for all index types

Required Methods§

Source

fn insert(&mut self, key: &[u8], value: u64) -> Result<()>

Insert a key-value pair into the index. The value is typically a pointer/offset to the actual data.

Source

fn find(&self, key: &[u8]) -> Result<Vec<u64>>

Find all values matching the exact key.

Source

fn remove(&mut self, key: &[u8]) -> Result<bool>

Remove all entries for a key from the index. Returns true if any entries were removed.

Source

fn len(&self) -> usize

Returns the number of entries in the index.

Source

fn clear(&mut self)

Clear all entries from the index.

Source

fn index_type(&self) -> IndexType

Returns the index type.

Provided Methods§

Source

fn is_empty(&self) -> bool

Returns true if the index is empty.

Implementors§