11 unstable releases (4 breaking)
0.5.0 | Jul 9, 2019 |
---|---|
0.4.3 | Dec 30, 2018 |
0.3.1 | Apr 16, 2018 |
0.2.1 | Mar 20, 2018 |
0.1.0 | Feb 27, 2018 |
11KB
222 lines
castor
An embedded content addressable store for Rust on top of kv
See https://docs.rs/castor for more information
lib.rs
:
castor
provides content addressable storage on top of LMDB
using kv
use castor::{Config, Store, Blake2s, Txn, Token};
fn main() -> Result<(), kv::Error> {
let cfg: Config<Blake2s> = Store::config("/tmp/castor-example");
let mut store: Store<Blake2s> = Store::new(cfg)?;
let bucket: kv::Bucket<Token<Blake2s>, &str> = store.bucket(None)?;
let token = store.with_write_txn(|mut txn| {
txn.put(&bucket, "testing")
})?;
let x = store.with_read_txn(move |txn| {
let value = txn.fetch(&bucket, token)?;
Ok(String::from(value))
})?;
assert_eq!(x, "testing");
Ok(())
}
Dependencies
~1.6–2.9MB
~61K SLoC