Trait perlin::storage::Storage [] [src]

pub trait Storage<T> where Self: Sync + Send {
    fn get(&self, id: u64) -> Result<Arc<T>>;
    fn store(&mut self, id: u64, data: T) -> Result<()>;
    fn len(&self) -> usize;

    fn is_empty(&self) -> bool { ... }
}

Defines a common interface between multiple storage types The index uses them to store data like the posting lists

Required Methods

Tries to get a value for a given Id. Returns an Error if read fails or if id is unknown.

Tries to store a value with a given Id. Returns an Error if Write fails or if there is no more space.

Returns the number of stored elements

Provided Methods

Returns true if storage is empty

Implementors