pub struct ChunkStore { /* private fields */ }Expand description
Local chunk store backed by Sled
Implementations§
Source§impl ChunkStore
impl ChunkStore
Sourcepub fn open<P: AsRef<Path>>(path: P) -> StorageResult<Self>
pub fn open<P: AsRef<Path>>(path: P) -> StorageResult<Self>
Open or create a chunk store at the given path
Sourcepub fn put(&self, chunk: &Chunk) -> StorageResult<()>
pub fn put(&self, chunk: &Chunk) -> StorageResult<()>
Store a chunk
Sourcepub fn contains(&self, hash: &ChunkHash) -> StorageResult<bool>
pub fn contains(&self, hash: &ChunkHash) -> StorageResult<bool>
Check if a chunk exists
Sourcepub fn delete(&self, hash: &ChunkHash) -> StorageResult<bool>
pub fn delete(&self, hash: &ChunkHash) -> StorageResult<bool>
Delete a chunk
Sourcepub fn count(&self) -> StorageResult<usize>
pub fn count(&self) -> StorageResult<usize>
Get total number of chunks stored
Sourcepub fn total_size(&self) -> StorageResult<u64>
pub fn total_size(&self) -> StorageResult<u64>
Get total size of all stored chunks in bytes
Sourcepub fn flush(&self) -> StorageResult<()>
pub fn flush(&self) -> StorageResult<()>
Flush all pending writes to disk
Auto Trait Implementations§
impl Freeze for ChunkStore
impl !RefUnwindSafe for ChunkStore
impl Send for ChunkStore
impl Sync for ChunkStore
impl Unpin for ChunkStore
impl !UnwindSafe for ChunkStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more