[−][src]Crate pearl
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, Key};
struct Id(String);
impl AsRef<[u8]> for Id {
fn as_ref(&self) -> &[u8] {
self.0.as_bytes()
}
}
impl Key for Id {
const LEN: u16 = 4;
}
#[tokio::main]
async fn main() {
let mut storage: Storage<Id> = 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(true)
.build()
.unwrap();
storage.init().await.unwrap();
let key = Id("test".to_string());
let data = b"Hello World!".to_vec();
storage.write(key, data).await.unwrap();
}
Modules
filter | bloom filter for faster check record contains in blob |
Structs
Builder | Is used to initialize a |
Entries |
|
Entry |
|
Error | The error type for |
Meta | Struct representing additional meta information. Helps to distinguish different version of the records with the same key. |
ReadAll | Stream of entries |
Storage | A main storage struct. |
Enums
ErrorKind | A list specifying categories of Storage error. |
Traits
Key | Trait |
Type Definitions
Result | A specialized storage result type. |