Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 28 additions & 94 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,6 @@ serde = "1.0"
serde_json = "1.0"
serde_plain = "0.3.0"
slab = "0.4"
sled = "0.34.7"
snap = "1"
sql-builder = "3.1"
sqlx = "0.8.2"
Expand Down
12 changes: 11 additions & 1 deletion db/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use ckb_db_schema::Col;
use ckb_logger::info;
use rocksdb::ops::{
CompactRangeCF, CreateCF, DropCF, GetColumnFamilys, GetPinned, GetPinnedCF, IterateCF, OpenCF,
Put, SetOptions, WriteOps,
Put, PutCF, SetOptions, WriteOps,
};
use rocksdb::{
BlockBasedIndexType, BlockBasedOptions, Cache, ColumnFamily, ColumnFamilyDescriptor,
Expand Down Expand Up @@ -179,6 +179,16 @@ impl RocksDB {
self.inner.get_pinned(key).map_err(internal_error)
}

/// Put a valueinto the given column under the given key.
pub fn put<K, V>(&self, col: Col, key: K, value: V) -> Result<()>
where
K: AsRef<[u8]>,
V: AsRef<[u8]>,
{
let cf = cf_handle(&self.inner, col)?;
self.inner.put_cf(cf, key, value).map_err(internal_error)
}

/// Insert a value into the database under the given key.
pub fn put_default<K, V>(&self, key: K, value: V) -> Result<()>
where
Expand Down
Loading
Loading