dragonquest / bitcask Goto Github PK
View Code? Open in Web Editor NEWBitcask Implementation in Rust. A fast key-value store.
License: MIT License
Bitcask Implementation in Rust. A fast key-value store.
License: MIT License
run demo:
use bitcask;
use bytesize::ByteSize;
fn main() {
let options = bitcask::Options {
base_dir: std::path::PathBuf::from("./db1"),
data_file_limit: ByteSize::mb(10).as_u64(),
};
let db = bitcask::new(options);
if let Err(err_msg) = db {
println!("{}", err_msg);
std::process::exit(1);
}
let mut db = db.unwrap();
for n in 0..1000 {
let name = format!("Peter Nr. {}", n);
let key = format!("name:{}", n);
db.write(key.as_bytes(), name.as_bytes()).unwrap();
}
db.close().unwrap();
}
error report:
thread 'main' panicked at 'attempted to leave type `database::lru::LruEntry<u128, datafile::DataFile>` uninitialized, which is invalid', /home/xx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/mem/mod.rs:659:9
stack backtrace:
0: rust_begin_unwind
at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:493:5
1: core::panicking::panic_fmt
at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/panicking.rs:92:14
2: core::panicking::panic
at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/panicking.rs:50:5
3: core::mem::uninitialized
at /home/xx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/mem/mod.rs:659:9
4: lru::LruCache<K,V,S>::construct
at /home/xx/.cargo/registry/src/github.com-1ecc6299db9ec823/lru-0.1.17/src/lib.rs:216:51
5: lru::LruCache<K,V>::new
at /home/xx/.cargo/registry/src/github.com-1ecc6299db9ec823/lru-0.1.17/src/lib.rs:173:9
6: bitcask::database::new
at /home/xx/.cargo/git/checkouts/bitcask-ef3cb47bcd03a3bd/f218892/src/database.rs:75:27
7: bitcask_rs::main
at ./src/main.rs:10:14
8: core::ops::function::FnOnce::call_once
at /home/xx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.