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§
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 Methods§
Sourcefn drop_storage(&self, _num_shards: usize) -> Result<(), String>
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".