Crates.io | redis_rocksdb |
lib.rs | redis_rocksdb |
version | 0.3.9 |
source | src |
created_at | 2022-03-01 01:43:40.56745 |
updated_at | 2024-04-11 00:50:33.795207 |
description | rust implement structure kv(key/value) embedded database, storage by rocksdb |
homepage | https://github.com/peacess/redis_rocksdb |
repository | https://github.com/peacess/redis_rocksdb |
max_upload_size | |
id | 541265 |
size | 193,265 |
rust implement structure kv(key/value) embedded database, storage by rocksdb
Feature list
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);
}
ssdb-rocks(c++)
ssdb
rust-rocksdb, no transaction
ckb-rocksdb, transaction
注:在v0.1.0版本时使用ckb-rocksdb,在v0.2.0版本中,为了减少一次函数调用,把事务与非事务分别使用不同的接口实现,所以就没有必要再使用ckb-rocksdb