|
|
@ -3,28 +3,46 @@ rust-rocksdb |
|
|
|
|
|
|
|
|
|
|
|
* rust wrapper for rocksdb |
|
|
|
* rust wrapper for rocksdb |
|
|
|
* development began 11/16/14 |
|
|
|
* development began 11/16/14 |
|
|
|
* status: minimal functionality with poor style and an annoying interface |
|
|
|
* status (uncompleted tasks are not ranked by priority): |
|
|
|
|
|
|
|
- [x] basic open/put/get/close |
|
|
|
``` |
|
|
|
- [x] linux support |
|
|
|
fn f() { |
|
|
|
- [x] rocksdb itself retrieved and compiled via cargo |
|
|
|
// arguments are path for rocksdb files, create if missing |
|
|
|
- [ ] OSX support |
|
|
|
let db = Rocksdb::open("testdb", true).unwrap(); |
|
|
|
- [ ] windows support |
|
|
|
db.put(b"a key", b"a value"); |
|
|
|
- [ ] batch |
|
|
|
... |
|
|
|
- [ ] iterator |
|
|
|
let r = db.get(b"this is key").unwrap(); |
|
|
|
- [ ] create/release snapshot |
|
|
|
db.close(); |
|
|
|
- [ ] range |
|
|
|
} |
|
|
|
- [ ] compaction filter, style |
|
|
|
``` |
|
|
|
- [ ] rustic merge operator |
|
|
|
|
|
|
|
- [ ] comparator |
|
|
|
|
|
|
|
- [ ] slicetransform |
|
|
|
|
|
|
|
- [ ] LRU cache |
|
|
|
|
|
|
|
- [ ] windows support |
|
|
|
|
|
|
|
- [ ] logger |
|
|
|
|
|
|
|
- [ ] column family operations |
|
|
|
|
|
|
|
- [ ] destroy/repair |
|
|
|
|
|
|
|
|
|
|
|
### running |
|
|
|
### running |
|
|
|
- get rocksdb |
|
|
|
- Cargo.toml |
|
|
|
``` |
|
|
|
``` |
|
|
|
git clone https://github.com/facebook/rocksdb |
|
|
|
[dependencies.rocksdb] |
|
|
|
cd rocksdb |
|
|
|
git = "https://github.com/spacejam/rust-rocksdb" |
|
|
|
make shared_lib |
|
|
|
|
|
|
|
``` |
|
|
|
``` |
|
|
|
- run tests |
|
|
|
- Code |
|
|
|
``` |
|
|
|
``` |
|
|
|
LD_PRELOAD=/path/to/rocksdb/librocksdb.so cargo test |
|
|
|
extern crate rocksdb; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn main() { |
|
|
|
|
|
|
|
let db = rocksdb::open("/path/to/db".to_string(), true).unwrap(); |
|
|
|
|
|
|
|
assert!(db.put(b"hey", b"v1111").is_ok()); |
|
|
|
|
|
|
|
db.get(b"hey").map( |raw| { |
|
|
|
|
|
|
|
std::str::from_utf8(raw.as_slice()).map( |v| { |
|
|
|
|
|
|
|
println!("value: {}", v); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
db.close() |
|
|
|
|
|
|
|
} |
|
|
|
``` |
|
|
|
``` |
|
|
|
- enjoy (as much as you can with such a poor current library! stay tuned!) |
|
|
|
|
|
|
|
|
|
|
|
- Feedback and pull requests welcome! |
|
|
|