[−][src]Struct pearl::Builder
Is used to initialize a Storage
.
Required params:
work_dir
- whereStorage
will keep blob and index filesmax_blob_size
- upper limit of blob file sizemax_data_in_blob
- maximum number of records in one blobblob_file_name_prefix
- prefix in blob file name pattern: {prefix}.{id}.{ext}key_size
- const key size in bytes
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();
Methods
impl Builder
[src]
#[must_use]
pub fn new() -> Self
[src]
Create new unitialized 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]
self,
blob_file_name_prefix: U
) -> Self
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.
#[must_use]
pub fn set_filter_config(self, config: BloomConfig) -> Self
[src]
Sets custom bloom filter config, if not set, use default values
Trait Implementations
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,