[−][src]Crate castor
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(()) }
Structs
Config | Castor configuration, parameterized by the digest type |
Store | A Store holds content adressable values |
Token | A Token is a unique identifier for a stored value |
Txn | A Txn is used to read and write from a Store |
Traits
Hash | Hash adds the |
Type Definitions
Blake2s | Blake2 Tokens |