Skip to main content

SparseShardStorage

Trait SparseShardStorage 

Source
pub trait SparseShardStorage: Send + Sync {
    // Required methods
    fn create_shard(&self, shard_id: usize) -> Result<SparseHandle, String>;
    fn open_shard(&self, shard_id: usize) -> Result<SparseHandle, String>;
    fn write_root_file(&self, name: &str, data: &[u8]) -> Result<(), String>;
    fn read_root_file(&self, name: &str) -> Result<Vec<u8>, String>;
    fn root_file_exists(&self, name: &str) -> bool;

    // Provided method
    fn drop_storage(&self, _num_shards: usize) -> Result<(), String> { ... }
}
Expand description

Where the shards and the root files of a sharded sparse index live.

Required Methods§

Source

fn create_shard(&self, shard_id: usize) -> Result<SparseHandle, String>

Source

fn open_shard(&self, shard_id: usize) -> Result<SparseHandle, String>

Source

fn write_root_file(&self, name: &str, data: &[u8]) -> Result<(), String>

Source

fn read_root_file(&self, name: &str) -> Result<Vec<u8>, String>

Source

fn root_file_exists(&self, name: &str) -> bool

Provided Methods§

Source

fn drop_storage(&self, _num_shards: usize) -> Result<(), String>

Destroy everything held for the index. Called by ShardedSparseHandle::drop_index once the handle is closed.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§