pub struct ValueLog<BC: BlobCache, C: Compressor + Clone>(/* private fields */);Expand description
A disk-resident value log
Implementations§
Source§impl<BC: BlobCache, C: Compressor + Clone> ValueLog<BC, C>
impl<BC: BlobCache, C: Compressor + Clone> ValueLog<BC, C>
Sourcepub fn open<P: Into<PathBuf>>(path: P, config: Config<BC, C>) -> Result<Self>
pub fn open<P: Into<PathBuf>>(path: P, config: Config<BC, C>) -> Result<Self>
Creates or recovers a value log in the given directory.
§Errors
Will return Err if an IO error occurs.
Sourcepub fn register_writer(&self, writer: SegmentWriter<C>) -> Result<()>
pub fn register_writer(&self, writer: SegmentWriter<C>) -> Result<()>
Sourcepub fn segment_count(&self) -> usize
pub fn segment_count(&self) -> usize
Returns the amount of segments in the value log.
Sourcepub fn get_with_prefetch(
&self,
vhandle: &ValueHandle,
prefetch_size: usize,
) -> Result<Option<UserValue>>
pub fn get_with_prefetch( &self, vhandle: &ValueHandle, prefetch_size: usize, ) -> Result<Option<UserValue>>
Resolves a value handle, and prefetches some values after it.
§Errors
Will return Err if an IO error occurs.
Sourcepub fn get_writer(&self) -> Result<SegmentWriter<C>>
pub fn get_writer(&self) -> Result<SegmentWriter<C>>
Sourcepub fn drop_stale_segments(&self) -> Result<u64>
pub fn drop_stale_segments(&self) -> Result<u64>
Drops stale segments.
Returns the amount of disk space (compressed data) freed.
§Errors
Will return Err if an IO error occurs.
Sourcepub fn space_amp(&self) -> f32
pub fn space_amp(&self) -> f32
Returns the approximate space amplification.
Returns 0.0 if there are no items.
Sourcepub fn scan_for_stats(
&self,
iter: impl Iterator<Item = Result<(ValueHandle, u32)>>,
) -> Result<GcReport>
pub fn scan_for_stats( &self, iter: impl Iterator<Item = Result<(ValueHandle, u32)>>, ) -> Result<GcReport>
Sourcepub fn apply_gc_strategy<R: IndexReader, W: IndexWriter>(
&self,
strategy: &impl GcStrategy<BC, C>,
index_reader: &R,
index_writer: W,
) -> Result<u64>
pub fn apply_gc_strategy<R: IndexReader, W: IndexWriter>( &self, strategy: &impl GcStrategy<BC, C>, index_reader: &R, index_writer: W, ) -> Result<u64>
Trait Implementations§
Auto Trait Implementations§
impl<BC, C> Freeze for ValueLog<BC, C>
impl<BC, C> RefUnwindSafe for ValueLog<BC, C>where
BC: RefUnwindSafe,
C: RefUnwindSafe,
impl<BC, C> Send for ValueLog<BC, C>
impl<BC, C> Sync for ValueLog<BC, C>
impl<BC, C> Unpin for ValueLog<BC, C>
impl<BC, C> UnwindSafe for ValueLog<BC, C>where
BC: RefUnwindSafe,
C: RefUnwindSafe,
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