Struct ckb_db::db::RocksDB [−][src]
pub struct RocksDB { /* fields omitted */ }
Expand description
RocksDB wrapper base on OptimisticTransactionDB
https://github.com/facebook/rocksdb/wiki/Transactions#optimistictransactiondb
Implementations
impl RocksDB
[src]
impl RocksDB
[src]pub fn repair<P: AsRef<Path>>(path: P) -> Result<()>
[src]
pub fn repair<P: AsRef<Path>>(path: P) -> Result<()>
[src]Repairer does best effort recovery to recover as much data as possible after a disaster without compromising consistency. It does not guarantee bringing the database to a time consistent state. Note: Currently there is a limitation that un-flushed column families will be lost after repair. This would happen even if the DB is in healthy state.
pub fn open(config: &DBConfig, columns: u32) -> Self
[src]
pub fn open(config: &DBConfig, columns: u32) -> Self
[src]Open a database with the given configuration and columns count.
pub fn open_tmp(columns: u32) -> Self
[src]
pub fn open_tmp(columns: u32) -> Self
[src]Open a temporary database with the default configuration and columns count.
pub fn prepare_for_bulk_load_open<P: AsRef<Path>>(
path: P,
columns: u32
) -> Result<Option<Self>>
[src]
pub fn prepare_for_bulk_load_open<P: AsRef<Path>>(
path: P,
columns: u32
) -> Result<Option<Self>>
[src]Set appropriate parameters for bulk loading.
pub fn get_pinned(
&self,
col: Col,
key: &[u8]
) -> Result<Option<DBPinnableSlice<'_>>>
[src]
pub fn get_pinned(
&self,
col: Col,
key: &[u8]
) -> Result<Option<DBPinnableSlice<'_>>>
[src]Return the value associated with a key using RocksDB’s PinnableSlice from the given column so as to avoid unnecessary memory copy.
pub fn get_pinned_default(
&self,
key: &[u8]
) -> Result<Option<DBPinnableSlice<'_>>>
[src]
pub fn get_pinned_default(
&self,
key: &[u8]
) -> Result<Option<DBPinnableSlice<'_>>>
[src]Return the value associated with a key using RocksDB’s PinnableSlice from the default column so as to avoid unnecessary memory copy.
pub fn put_default<K, V>(&self, key: K, value: V) -> Result<()> where
K: AsRef<[u8]>,
V: AsRef<[u8]>,
[src]
pub fn put_default<K, V>(&self, key: K, value: V) -> Result<()> where
K: AsRef<[u8]>,
V: AsRef<[u8]>,
[src]Insert a value into the database under the given key.
pub fn traverse<F>(&self, col: Col, callback: F) -> Result<()> where
F: FnMut(&[u8], &[u8]) -> Result<()>,
[src]
pub fn traverse<F>(&self, col: Col, callback: F) -> Result<()> where
F: FnMut(&[u8], &[u8]) -> Result<()>,
[src]Traverse database column with the given callback function.
pub fn transaction(&self) -> RocksDBTransaction
[src]
pub fn transaction(&self) -> RocksDBTransaction
[src]Set a snapshot at start of transaction by setting set_snapshot=true
pub fn new_write_batch(&self) -> RocksDBWriteBatch
[src]
pub fn new_write_batch(&self) -> RocksDBWriteBatch
[src]Construct RocksDBWriteBatch
with default option.
pub fn write(&self, batch: &RocksDBWriteBatch) -> Result<()>
[src]
pub fn write(&self, batch: &RocksDBWriteBatch) -> Result<()>
[src]Write batch into transaction db.
pub fn write_sync(&self, batch: &RocksDBWriteBatch) -> Result<()>
[src]
pub fn write_sync(&self, batch: &RocksDBWriteBatch) -> Result<()>
[src]WriteOptions set_sync true If true, the write will be flushed from the operating system buffer cache (by calling WritableFile::Sync()) before the write is considered complete. If this flag is true, writes will be slower.
If this flag is false, and the machine crashes, some recent writes may be lost. Note that if it is just the process that crashes (i.e., the machine does not reboot), no writes will be lost even if sync==false.
In other words, a DB write with sync==false has similar crash semantics as the “write()” system call. A DB write with sync==true has similar crash semantics to a “write()” system call followed by “fdatasync()”.
Default: false
pub fn compact_range(
&self,
col: Col,
start: Option<&[u8]>,
end: Option<&[u8]>
) -> Result<()>
[src]
pub fn compact_range(
&self,
col: Col,
start: Option<&[u8]>,
end: Option<&[u8]>
) -> Result<()>
[src]The begin and end arguments define the key range to be compacted. The behavior varies depending on the compaction style being used by the db. In case of universal and FIFO compaction styles, the begin and end arguments are ignored and all files are compacted. Also, files in each level are compacted and left in the same level. For leveled compaction style, all files containing keys in the given range are compacted to the last level containing files. If either begin or end are NULL, it is taken to mean the key before all keys in the db or the key after all keys respectively.
If more than one thread calls manual compaction, only one will actually schedule it while the other threads will simply wait for the scheduled manual compaction to complete.
CompactRange waits while compaction is performed on the background threads and thus is a blocking call.
pub fn get_snapshot(&self) -> RocksDBSnapshot
[src]
pub fn get_snapshot(&self) -> RocksDBSnapshot
[src]Return RocksDBSnapshot
.
pub fn inner(&self) -> Arc<OptimisticTransactionDB>
[src]
pub fn inner(&self) -> Arc<OptimisticTransactionDB>
[src]Return rocksdb OptimisticTransactionDB
.
Trait Implementations
impl DBIterator for RocksDB
[src]
impl DBIterator for RocksDB
[src]fn iter_opt(
&self,
col: Col,
mode: IteratorMode<'_>,
readopts: &ReadOptions
) -> Result<DBIter<'_>>
[src]
fn iter_opt(
&self,
col: Col,
mode: IteratorMode<'_>,
readopts: &ReadOptions
) -> Result<DBIter<'_>>
[src]Opens an interator using the provided IteratorMode and ReadOptions. This is used when you want to iterate over a specific ColumnFamily with a modified ReadOptions Read more
Auto Trait Implementations
impl RefUnwindSafe for RocksDB
impl Send for RocksDB
impl Sync for RocksDB
impl Unpin for RocksDB
impl UnwindSafe for RocksDB
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,