sequenceDiagram
autonumber
participant dakv
participant W as writer worker
participant C as compaction worker
Note over dakv: main thread
Note over W: writer thread
Note over C: compaction thread
dakv->>W: start writer worker
dakv->>C: start compaction worker
loop
W-->>W: wait for writer signal
end
loop
C-->>C: Wait for compaction signal
end
participant Log as write ahead log
participant Mem as memtable
dakv->>W: write kv record
W-->>C: maybe trigger compaction
W->>Log: write record
W->>Mem: insert into memtable
W->>dakv: send OK message
use dakv::{Database, Options, ReadOptions, TestEnv, WriteOptions, DB};
use std::sync::Arc;
fn main() {
let db = {
let mut opt = Options::default();
opt.env = Arc::new(TestEnv::default());
DB::open("example_db".to_string(), opt).unwrap()
};
let write_opt = WriteOptions::default();
db.put(
b"Red",
b"Let me tell you something my friend. Hope is a dangerous thing. Hope can drive a man insane.",
write_opt.clone(),
).unwrap();
{
let opt = ReadOptions::new();
assert!(db.get(b"Red", opt.clone()).is_ok());
db.delete(b"Red", write_opt.clone()).unwrap();
assert_eq!(db.get(b"Red", opt).unwrap_err().to_string(), "NotFound");
}
db.put(
b"Andy Dufresne",
b"Remember Red, hope is a good thing, maybe the best of things, and no good thing ever dies.",
write_opt.clone(),
).unwrap();
}
cd dakv
git submodule update --init --recursive
cargo build
- Fast CRC (support see and PCLMULQDQ instructions)
- Support io_uring
- Implement WiscKey to improve performance.
- Use DB session ID as the cache key prefix to ensure uniqueness and repeatability
- Fuzz testing with rust-fuzz/afl
- Support multi get.
- YCSB Benchmark