QStorage Logo

File system based object storage, can also be used as a persistent KV database.

Overview

Version

Quick start

```rust extern crate qstorage;

use qstorage::QStorage; use std::io::Error;

fn main() -> Result<(), Error> { let dirname = String::from("./storage"); let mut storage = QStorage::new(dirname, 10737418240, 1048576)?;

storage.ready()?;

let key = String::from("hello");
let value = "word".as_bytes().to_vec();

storage.insert(key.clone(), value)?;

if let Some(data) = storage.get(key)? {
    println!("{}", String::from_utf8_lossy(data.as_slice()));
}

storage.closed()?;
Ok(())

} ```

Note

closed Clean up before shutdown.
This is a required operation. You must do the final cleanup before each shutdown, save the state, you can also call this function each time you need to save the state.
This operation will write the memory data to the file system.
For example, listen to the exit event of the process, and then call this function.

License

MIT Copyright (c) 2019 Mr.Panda.