9 releases
0.3.6 | Feb 18, 2023 |
---|---|
0.3.5 | Feb 16, 2023 |
0.3.4 | Jan 29, 2023 |
0.1.3 | Apr 12, 2022 |
0.1.1 | Mar 7, 2022 |
#504 in Database interfaces
27 downloads per month
140KB
3K
SLoC
redis_rocksdb
rust implement structure kv(key/value) embedded database, storage by rocksdb
Feature list
- redis list
- Object, key+field
- ObjectBit, a bit object
- Max/Min binary heap(zero copy)
- B + Tree (Binary plus Tree) ...
Sample
more details see the test
Max Heap
use rocksdb::TransactionDB;
use redis_rocksdb::{Heap, RedisRocksdb, WrapTransactionDB};
fn sample(){
let trans_db= TransactionDB::open_default("db_name.db").expect("");
let redis_db = RedisRocksdb::new(trans_db);
let wrap_db = WrapTransactionDB { db: redis_db.get_db() };
let max_heap = RedisRocksdb::max_heap();
let key = vec![0 as u8, 1, 2];
let field = vec![6 as u8, 7, 8];
let value = "data".to_owned();
let _ = max_heap.push(&wrap_db, &field, value.as_bytes());
let _ = max_heap.pop(&wrap_db, &key);
}
Object
use rocksdb::TransactionDB;
use redis_rocksdb::{Heap, Object, RedisRocksdb, WrapTransactionDB};
fn sample(){
let trans_db= TransactionDB::open_default("db_name.db").expect("");
let redis_db = RedisRocksdb::new(trans_db);
let wrap_db = WrapTransactionDB { db: redis_db.get_db() };
let object = RedisRocksdb::object();
let key = vec![0 as u8, 1, 2];
let field = vec![6 as u8, 7, 8];
let value = "data".to_owned();
let _ = object.set(&wrap_db, &field, value.as_bytes());
let _ = object.get(&wrap_db, &key, &field);
}
Install
Window
- install llvm
- Environment value: set LIBCLANG_PATH=E:/lang/LLVM/lib --- sometimes need to restart the window system for clion
Linux
See:
ssdb-rocks(c++)
ssdb
rust-rocksdb, no transaction
ckb-rocksdb, transaction
注:在v0.1.0版本时使用ckb-rocksdb,在v0.2.0版本中,为了减少一次函数调用,把事务与非事务分别使用不同的接口实现,所以就没有必要再使用ckb-rocksdb
Dependencies
~25MB
~518K SLoC