#cdb #world #file

cdb

Pure Rust library to read and write CDB files

2 unstable releases

Uses old Rust 2015

0.6.0 Oct 26, 2018
0.5.0 Jan 11, 2016

#10 in #cdb

Download history 4/week @ 2024-12-26 49/week @ 2025-01-02 180/week @ 2025-01-09 219/week @ 2025-01-16 337/week @ 2025-01-23 125/week @ 2025-01-30 635/week @ 2025-02-06 406/week @ 2025-02-13 120/week @ 2025-02-20 246/week @ 2025-02-27 290/week @ 2025-03-06 310/week @ 2025-03-13 240/week @ 2025-03-20 134/week @ 2025-03-27 170/week @ 2025-04-03 207/week @ 2025-04-10

787 downloads per month
Used in reflicate

Unlicense

39KB
383 lines

This crate provides support for reading and writing CDB files. A CDB is a "constant database" that acts as an on-disk associative array mapping keys to values, allowing multiple values for each key. It provides for fast lookups and low overheads. A constant database has no provision for updating, only rewriting from scratch.

Examples

Reading a set of records:

let cdb = cdb::CDB::open("tests/test1.cdb").unwrap();

for result in cdb.find(b"one") {
    println!("{:?}", result.unwrap());
}

Creating a database with safe atomic updating:

fn main() -> std::io::Result<()> {
    let mut cdb = cdb::CDBWriter::create("temporary.cdb")?;
    cdb.add(b"one", b"Hello, ")?;
    cdb.add(b"one", b"world!\n")?;
    cdb.add(b"two", &[1, 2, 3, 4])?;
    cdb.finish()?;
    Ok(())
}

References


cdb

Crate Build Status

This library provides pure Rust support for reading and writing CDB files. A CDB file is a constant key-value on-disk hash table, designed for high-speed lookups.

Documentation

License

Public Domain

Dependencies

~235KB