https://github.com/meilisearch/obkv
A micro key-value store where the key is always one byte
https://github.com/meilisearch/obkv
Last synced: 6 months ago
JSON representation
A micro key-value store where the key is always one byte
- Host: GitHub
- URL: https://github.com/meilisearch/obkv
- Owner: meilisearch
- License: mit
- Created: 2020-10-21T09:58:29.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2025-01-10T13:15:02.000Z (about 1 year ago)
- Last Synced: 2025-07-09T16:58:11.777Z (6 months ago)
- Language: Rust
- Size: 43.9 KB
- Stars: 11
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# obkv
A micro key-value store where the key is always one byte.
It is highly inspired by the [KVDS crate](https://lib.rs/crates/kvds).
# Usage
```rust
let mut writer = KvWriter::memory();
writer.insert(0, b"hello").unwrap();
writer.insert(1, b"blue").unwrap();
writer.insert(255, b"world").unwrap();
let obkv = writer.into_inner().unwrap();
let reader = KvReader::new(&obkv);
assert_eq!(reader.get(0), Some(&b"hello"[..]));
assert_eq!(reader.get(1), Some(&b"blue"[..]));
assert_eq!(reader.get(10), None);
assert_eq!(reader.get(255), Some(&b"world"[..]));
```