ValueLog

Struct ValueLog 

Source
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>

Source

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.

Source

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

Registers a SegmentWriter.

§Errors

Will return Err if an IO error occurs.

Source

pub fn segment_count(&self) -> usize

Returns the amount of segments in the value log.

Source

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

Resolves a value handle.

§Errors

Will return Err if an IO error occurs.

Source

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.

Source

pub fn get_writer(&self) -> Result<SegmentWriter<C>>

Initializes a new segment writer.

§Errors

Will return Err if an IO error occurs.

Source

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.

Source

pub fn space_amp(&self) -> f32

Returns the approximate space amplification.

Returns 0.0 if there are no items.

Source

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

Scans the given index and collects GC statistics.

§Errors

Will return Err if an IO error occurs.

Source

pub fn apply_gc_strategy<R: IndexReader, W: IndexWriter>( &self, strategy: &impl GcStrategy<BC, C>, index_reader: &R, index_writer: W, ) -> Result<u64>

Applies a GC strategy.

§Errors

Will return Err if an IO error occurs.

Source

pub fn clear(&self, prune_async: bool) -> Result<()>

Atomically removes all data from the value log.

If prune_async is set to true, the blob files will be removed from disk in a thread to avoid blocking.

Trait Implementations§

Source§

impl<BC: Clone + BlobCache, C: Clone + Compressor + Clone> Clone for ValueLog<BC, C>

Source§

fn clone(&self) -> ValueLog<BC, C>

Returns a duplicate 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<BC: BlobCache, C: Compressor + Clone> Deref for ValueLog<BC, C>

Source§

type Target = ValueLogInner<BC, C>

The resulting type after dereferencing.
Source§

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

Dereferences the value.

Auto Trait Implementations§

§

impl<BC, C> Freeze for ValueLog<BC, C>

§

impl<BC, C> RefUnwindSafe for ValueLog<BC, C>

§

impl<BC, C> Send for ValueLog<BC, C>
where BC: Sync + Send, C: Sync + Send,

§

impl<BC, C> Sync for ValueLog<BC, C>
where BC: Sync + Send, C: Sync + Send,

§

impl<BC, C> Unpin for ValueLog<BC, C>

§

impl<BC, C> UnwindSafe for ValueLog<BC, C>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

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

Source§

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>,

Source§

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>,

Source§

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.