Skip to main content

Crate lkv

Crate lkv 

Source
Expand description

§lkv

A lightweight and fast embedded key-value store for Rust.

For more details, see the crates.io.

§Examples

use lkv::{Database, Result};

fn main() -> Result<()> {
    let mut db = Database::create("./example.lkv")?;
    let mut write = db.begin_write()?;
    write.put("name", "lkv")?;
    write.commit()?;

    let read = db.begin_read()?;
    assert_eq!(read.get("name")?, Some(b"lkv".as_slice()));
    for item in read.iter()? {
        let (key, value) = item?;
        println!("{} = {}",
            String::from_utf8_lossy(key),
            String::from_utf8_lossy(value));
    }
    drop(read);

    Ok(())
}

Structs§

Corruption
Location and category of a database integrity failure.
Database
Represents an open lkv database.
DatabaseOptions
Provides configuration options for the database.
DatabaseStats
Constant-time structural and maintenance metrics for a database.
Entries
Fallible zero-copy iterator over a consistent database view.
ReadTransaction
Read-only transaction of the database.
ReservedValue
A sequential writer for an exactly-sized value reservation.
Snapshot
Read-only snapshot of the database.
WriteTransaction
Write transaction for the database.

Enums§

CorruptionKind
The class of integrity failure that was detected.
Error
Errors returned by lkv API.
VerificationMode
Integrity work performed while opening a database.

Type Aliases§

Result
Result type for lkv APIs.