pub struct StorageContext { /* private fields */ }Expand description
Helper that aligns all persisted artifacts (sled, future caches) under a single directory.
Implementations§
Source§impl StorageContext
impl StorageContext
Sourcepub fn new(data_root: impl AsRef<Path>) -> StorageResult<Self>
pub fn new(data_root: impl AsRef<Path>) -> StorageResult<Self>
Creates the metadata directory (if missing) beneath data_root.
Sourcepub fn metadata_store(&self) -> StorageResult<SledMetadataStore>
pub fn metadata_store(&self) -> StorageResult<SledMetadataStore>
Returns a sled-backed metadata store rooted at this context’s path.
pub fn log_tree(&self) -> StorageResult<Tree>
pub fn metadata_path(&self) -> &Path
pub fn log_path(&self) -> &Path
Sourcepub fn compact_all(&self) -> StorageResult<()>
pub fn compact_all(&self) -> StorageResult<()>
Compact both metadata and logs databases to reclaim space.
Sourcepub fn stats(&self) -> StorageResult<DbStats>
pub fn stats(&self) -> StorageResult<DbStats>
Get statistics about the database storage.
Sourcepub fn prune_old_log_entries(&self, max_age: Duration) -> StorageResult<usize>
pub fn prune_old_log_entries(&self, max_age: Duration) -> StorageResult<usize>
Prune log entries older than the specified duration. Returns the number of entries pruned.
Trait Implementations§
Source§impl Clone for StorageContext
impl Clone for StorageContext
Source§fn clone(&self) -> StorageContext
fn clone(&self) -> StorageContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for StorageContext
impl RefUnwindSafe for StorageContext
impl Send for StorageContext
impl Sync for StorageContext
impl Unpin for StorageContext
impl UnwindSafe for StorageContext
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