use stack_db::prelude::*;
fn main() {
let allocator = SkdbDirAlloc::new("db.skdb").unwrap(); let mut database = StackDB::new(allocator).unwrap();
database.write(256, b"hello, ").unwrap();
database.write(256+7, b"world").unwrap();
assert_eq!(&*database.read(256..268).unwrap(), b"hello, world");
database.commit().unwrap();
database.write(256, b"H").unwrap();
database.write(256+7, b"W").unwrap();
database.write(268, b"!").unwrap();
database.commit().unwrap();
let mut database = StackDB::new(SkdbDirAlloc::load("db.skdb").unwrap()).unwrap();
assert_eq!(&*database.read(256..269).unwrap(), b"Hello, World!");
}