Struct pearl::Builder[][src]

pub struct Builder { /* fields omitted */ }

Is used to initialize a Storage.

Required params:

Example

use pearl::{Builder, Storage, Key};

struct Id;

let storage: Storage<Id> = Builder::new()
        .blob_file_name_prefix("benchmark")
        .max_blob_size(10_000_000)
        .max_data_in_blob(1_000)
        .work_dir(std::env::temp_dir().join("pearl_benchmark"))
        .build()
        .unwrap();

Implementations

impl Builder[src]

#[must_use]pub fn new() -> Self[src]

Create new uninitialized Builder

pub fn build<K>(self) -> Result<Storage<K>>[src]

Creates Storage based on given configuration, returns error if not all params are set.

Errors

Return error if some of the required params is missed

pub fn work_dir<S: Into<PathBuf>>(self, work_dir: S) -> Self[src]

Sets working directory. If path doesn’t exists, Storage will try to create it at initialization stage.

#[must_use]pub fn max_blob_size(self, max_blob_size: u64) -> Self[src]

Sets blob file size approximate limit. When the file size exceeds it, active blob update is activated. Must be greater than zero

#[must_use]pub fn max_data_in_blob(self, max_data_in_blob: u64) -> Self[src]

Limits max number of records in a single blob. Must be greater than zero

pub fn blob_file_name_prefix<U: Into<String>>(
    self,
    blob_file_name_prefix: U
) -> Self
[src]

Sets blob file name prefix, e.g. if prefix set to hellopearl, files will be named as hellopearl.[N].blob. Where N - index number of file If the prefix is empty, param won’t be set.

#[must_use]pub fn allow_duplicates(self) -> Self[src]

Disables check existence of the record on write. Writing becomes faster because there is no additional disk access for searching for duplicates.

pub fn ignore_corrupted(self) -> Self[src]

Ignores blobs with corrupted header for index file and continues work with normal ones (also leaves error logs for bad blobs). It’s worth noticing that index file maybe corrupted likely in case of irregular stop of the storage: either the disk disconnected or server crashed. In these cases blob file is likely either corrupted, so there is no a try to restore indices from blob file.

#[must_use]pub fn set_filter_config(self, config: BloomConfig) -> Self[src]

Sets custom bloom filter config, if not set, use default values.

#[must_use]pub fn enable_aio(self, ioring: Rio) -> Self[src]

Enables linux AIO with provided io_uring.

#[must_use]pub fn create_work_dir(self, create: bool) -> Self[src]

[Optional] Sets whether to create work directory if its missing on storage initialization. Default value is true

pub fn set_dump_sem(self, dump_sem: Arc<Semaphore>) -> Self[src]

Sets semaphore for index dumping on blob change. Parallel saving of indexes onto the disk will be limited by this semaphore. This can prevent disk overusage in systems with multiple pearls.

Trait Implementations

impl Debug for Builder[src]

impl Default for Builder[src]

Auto Trait Implementations

impl !RefUnwindSafe for Builder

impl Send for Builder

impl Sync for Builder

impl Unpin for Builder

impl !UnwindSafe for Builder

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,