Crate pearl

Source
Expand description

§pearl

The pearl library is an asyncronous Append only key-value blob storage on disk. Crate pearl provides Futures 0.3 interface. Tokio runtime required. Storage follows no harm policy, which means that it won’t delete or change any of the stored data.

§Examples

The following example shows a storage building and initialization. For more advanced usage see the benchmark tool as the example

use pearl::{Storage, Builder, ArrayKey, BlobRecordTimestamp};

#[tokio::main]
async fn main() {
    let mut storage: Storage<ArrayKey<8>> = Builder::new()
        .work_dir("/tmp/pearl/")
        .max_blob_size(1_000_000)
        .max_data_in_blob(1_000_000_000)
        .blob_file_name_prefix("pearl-test")
        .allow_duplicates()
        .build()
        .unwrap();
    storage.init().await.unwrap();
    let key = ArrayKey::<8>::default();
    let data = b"Hello World!".to_vec();
    let timestamp = BlobRecordTimestamp::now();
    storage.write(key, data.into(), timestamp).await.unwrap();
}

Re-exports§

pub use filter::Bloom;
pub use filter::BloomDataProvider;
pub use filter::BloomProvider;
pub use filter::Config as BloomConfig;
pub use filter::FilterResult;
pub use error::Error;
pub use error::Kind as ErrorKind;

Modules§

build_info
Basic info about current build.
error
Types representing various errors that can occur in pearl.
filter
bloom filter for faster check record contains in blob
tools
tools to interact with pearl structures

Structs§

ArrayKey
Key for demonstration purposes
BlobRecordTimestamp
Timestamp
Builder
Is used to initialize a Storage.
Entry
Entry is a [Future], which contains header and metadata of the record, but does not contain all of the data in memory.
IoDriver
IO driver for file operations
Meta
Struct representing additional meta information. Helps to distinguish different version of the records with the same key.
Storage
A main storage struct.

Enums§

ReadResult
Result of read operations

Traits§

Key
Trait Key
RefKey
Trait for reference key type