SmollDB
Small in-memory key value database for rust
This is a small in-memory key-value database, which can be easly backed up in a file or stream and later loaded from it
It ain't much but it's honest work
This database is nothing but an hashmap, it already comes with function to easly load and save the hashmap on file though, so you don't have to implement it. It also compress it in a Zlib compatible format
Inspired by Pickles
This crate was inspired by pickleDB and it works in similars use cases
Now with streams
since 0.4.0
You can use function load_from_stream to load from anything that implements std::io::Read, and you can use backup_to_stream to backup on antything that implements std::io::Write
Some examples
Basic use
let mut db = default;
db.set;
db.set;
db.set;
db.set;
db.set;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
Loading from file
let mut db = default;
db.set;
db.set;
db.set;
db.set;
db.set;
db.set;
db.set;
db.set;
db.set;
db.backup.unwrap;
let db_copy = load.unwrap;
assert_eq!;
Load and backup from stream
let mut database = default;
let mut stream = new.create.read.write.open.unwrap;
let data = Stringfrom;
let key = Stringfrom;
database.set;
database.backup_to_stream.unwrap;
stream.seek.unwrap;
let database = load_from_stream.unwrap;
let result = database.get.unwrap;
assert_eq!;