pub struct ValueLog(/* private fields */);Expand description
A disk-resident value log
Implementations§
source§impl ValueLog
impl ValueLog
sourcepub fn open<P: Into<PathBuf>>(path: P, config: Config) -> Result<Self>
pub fn open<P: Into<PathBuf>>(path: P, config: Config) -> 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<W: IndexWriter>(
&self,
writer: SegmentWriter<W>,
) -> Result<()>
pub fn register_writer<W: IndexWriter>( &self, writer: SegmentWriter<W>, ) -> Result<()>
sourcepub fn segment_count(&self) -> usize
pub fn segment_count(&self) -> usize
Returns segment count
sourcepub fn get_writer<W: IndexWriter>(
&self,
index_writer: W,
) -> Result<SegmentWriter<W>>
pub fn get_writer<W: IndexWriter>( &self, index_writer: W, ) -> Result<SegmentWriter<W>>
sourcepub fn select_segments_for_space_amp_reduction(
&self,
space_amp_target: f32,
) -> Vec<u64>
pub fn select_segments_for_space_amp_reduction( &self, space_amp_target: f32, ) -> Vec<u64>
Tries to find a least-effort-selection of segments to merge to reach a certain space amplification.
sourcepub fn find_segments_with_stale_threshold(&self, threshold: f32) -> Vec<u64>
pub fn find_segments_with_stale_threshold(&self, threshold: f32) -> Vec<u64>
Finds segment IDs that have reached a stale threshold.
sourcepub fn drop_stale_segments(&self) -> Result<()>
pub fn drop_stale_segments(&self) -> Result<()>
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<()>
pub fn scan_for_stats( &self, iter: impl Iterator<Item = Result<(ValueHandle, u32)>>, ) -> Result<()>
sourcepub fn rollover<R: IndexReader, W: IndexWriter>(
&self,
ids: &[u64],
index_reader: &R,
index_writer: W,
) -> Result<()>
pub fn rollover<R: IndexReader, W: IndexWriter>( &self, ids: &[u64], index_reader: &R, index_writer: W, ) -> Result<()>
Rewrites some segments into new segment(s), blocking the caller until the operation is completely done.
§Errors
Will return Err if an IO error occurs.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ValueLog
impl !RefUnwindSafe for ValueLog
impl Send for ValueLog
impl Sync for ValueLog
impl Unpin for ValueLog
impl !UnwindSafe for ValueLog
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