Struct value_log::ValueLog

source ·
pub struct ValueLog(/* private fields */);
Expand description

A disk-resident value log

Implementations§

source§

impl ValueLog

source

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.

source

pub fn register_writer<W: IndexWriter>( &self, writer: SegmentWriter<W>, ) -> Result<()>

Registers writer

§Errors

Will return Err if an IO error occurs.

source

pub fn segment_count(&self) -> usize

Returns segment count

source

pub fn get(&self, handle: &ValueHandle) -> Result<Option<UserValue>>

Resolves a value handle

§Errors

Will return Err if an IO error occurs.

source

pub fn get_writer<W: IndexWriter>( &self, index_writer: W, ) -> Result<SegmentWriter<W>>

Initializes a new segment writer

§Errors

Will return Err if an IO error occurs.

source

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.

source

pub fn find_segments_with_stale_threshold(&self, threshold: f32) -> Vec<u64>

Finds segment IDs that have reached a stale threshold.

source

pub fn drop_stale_segments(&self) -> Result<()>

Drops stale segments.

§Errors

Will return Err if an IO error occurs.

source

pub fn scan_for_stats( &self, iter: impl Iterator<Item = Result<(ValueHandle, u32)>>, ) -> Result<()>

Scans the given index and collecting GC statistics.

§Errors

Will return Err if an IO error occurs.

source

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§

source§

impl Clone for ValueLog

source§

fn clone(&self) -> ValueLog

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Deref for ValueLog

§

type Target = ValueLogInner

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.