Struct pearl::Builder[][src]

pub struct Builder { /* fields omitted */ }
Expand description

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

Create new uninitialized Builder

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 or wrong

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

Sets directory name for corrupted files. If path doesn’t exists, Storage will try to create it at initialization stage.

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

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

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.

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

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.

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

Enables linux AIO with provided io_uring.

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

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.

Sets bloom filter group size

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Converts self into T using Into<T>. Read more

Causes self to use its Binary implementation when Debug-formatted.

Causes self to use its Display implementation when Debug-formatted. Read more

Causes self to use its LowerExp implementation when Debug-formatted. Read more

Causes self to use its LowerHex implementation when Debug-formatted. Read more

Causes self to use its Octal implementation when Debug-formatted.

Causes self to use its Pointer implementation when Debug-formatted. Read more

Causes self to use its UpperExp implementation when Debug-formatted. Read more

Causes self to use its UpperHex implementation when Debug-formatted. Read more

Performs the conversion.

Performs the conversion.

Pipes by value. This is generally the method you want to use. Read more

Borrows self and passes that borrow into the pipe function. Read more

Mutably borrows self and passes that borrow into the pipe function. Read more

Borrows self, then passes self.borrow() into the pipe function. Read more

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more

Borrows self, then passes self.as_ref() into the pipe function.

Mutably borrows self, then passes self.as_mut() into the pipe function. Read more

Borrows self, then passes self.deref() into the pipe function.

Mutably borrows self, then passes self.deref_mut() into the pipe function. Read more

Immutable access to a value. Read more

Mutable access to a value. Read more

Immutable access to the Borrow<B> of a value. Read more

Mutable access to the BorrowMut<B> of a value. Read more

Immutable access to the AsRef<R> view of a value. Read more

Mutable access to the AsMut<R> view of a value. Read more

Immutable access to the Deref::Target of a value. Read more

Mutable access to the Deref::Target of a value. Read more

Calls .tap() only in debug builds, and is erased in release builds.

Calls .tap_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_borrow() only in debug builds, and is erased in release builds. Read more

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_ref() only in debug builds, and is erased in release builds. Read more

Calls .tap_ref_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_deref() only in debug builds, and is erased in release builds. Read more

Calls .tap_deref_mut() only in debug builds, and is erased in release builds. Read more

Attempts to convert self into T using TryInto<T>. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.