pub struct DBCommon<T: ThreadMode, D: DBInner> { /* private fields */ }
Expand description
A helper type to implement some common methods for DBWithThreadMode
and OptimisticTransactionDB
.
Implementations§
source§impl<T: ThreadMode> DBCommon<T, DBWithThreadModeInner>
impl<T: ThreadMode> DBCommon<T, DBWithThreadModeInner>
Methods of DBWithThreadMode
.
sourcepub fn open_default<P: AsRef<Path>>(path: P) -> Result<Self, Error>
pub fn open_default<P: AsRef<Path>>(path: P) -> Result<Self, Error>
Opens a database with default options.
sourcepub fn open<P: AsRef<Path>>(opts: &Options, path: P) -> Result<Self, Error>
pub fn open<P: AsRef<Path>>(opts: &Options, path: P) -> Result<Self, Error>
Opens the database with the specified options.
sourcepub fn open_for_read_only<P: AsRef<Path>>(
opts: &Options,
path: P,
error_if_log_file_exist: bool,
) -> Result<Self, Error>
pub fn open_for_read_only<P: AsRef<Path>>( opts: &Options, path: P, error_if_log_file_exist: bool, ) -> Result<Self, Error>
Opens the database for read only with the specified options.
sourcepub fn open_as_secondary<P: AsRef<Path>>(
opts: &Options,
primary_path: P,
secondary_path: P,
) -> Result<Self, Error>
pub fn open_as_secondary<P: AsRef<Path>>( opts: &Options, primary_path: P, secondary_path: P, ) -> Result<Self, Error>
Opens the database as a secondary.
sourcepub fn open_with_ttl<P: AsRef<Path>>(
opts: &Options,
path: P,
ttl: Duration,
) -> Result<Self, Error>
pub fn open_with_ttl<P: AsRef<Path>>( opts: &Options, path: P, ttl: Duration, ) -> Result<Self, Error>
Opens the database with a Time to Live compaction filter.
sourcepub fn open_cf_with_ttl<P, I, N>(
opts: &Options,
path: P,
cfs: I,
ttl: Duration,
) -> Result<Self, Error>
pub fn open_cf_with_ttl<P, I, N>( opts: &Options, path: P, cfs: I, ttl: Duration, ) -> Result<Self, Error>
Opens the database with a Time to Live compaction filter and column family names.
Column families opened using this function will be created with default Options
.
sourcepub fn open_cf_descriptors_with_ttl<P, I>(
opts: &Options,
path: P,
cfs: I,
ttl: Duration,
) -> Result<Self, Error>
pub fn open_cf_descriptors_with_ttl<P, I>( opts: &Options, path: P, cfs: I, ttl: Duration, ) -> Result<Self, Error>
Opens a database with the given database with a Time to Live compaction filter and column family descriptors.
sourcepub fn open_cf<P, I, N>(opts: &Options, path: P, cfs: I) -> Result<Self, Error>
pub fn open_cf<P, I, N>(opts: &Options, path: P, cfs: I) -> Result<Self, Error>
Opens a database with the given database options and column family names.
Column families opened using this function will be created with default Options
.
sourcepub fn open_cf_with_opts<P, I, N>(
opts: &Options,
path: P,
cfs: I,
) -> Result<Self, Error>
pub fn open_cf_with_opts<P, I, N>( opts: &Options, path: P, cfs: I, ) -> Result<Self, Error>
Opens a database with the given database options and column family names.
Column families opened using given Options
.
sourcepub fn open_cf_for_read_only<P, I, N>(
opts: &Options,
path: P,
cfs: I,
error_if_log_file_exist: bool,
) -> Result<Self, Error>
pub fn open_cf_for_read_only<P, I, N>( opts: &Options, path: P, cfs: I, error_if_log_file_exist: bool, ) -> Result<Self, Error>
Opens a database for read only with the given database options and column family names.
sourcepub fn open_cf_with_opts_for_read_only<P, I, N>(
db_opts: &Options,
path: P,
cfs: I,
error_if_log_file_exist: bool,
) -> Result<Self, Error>
pub fn open_cf_with_opts_for_read_only<P, I, N>( db_opts: &Options, path: P, cfs: I, error_if_log_file_exist: bool, ) -> Result<Self, Error>
Opens a database for read only with the given database options and column family names.
sourcepub fn open_cf_descriptors_read_only<P, I>(
opts: &Options,
path: P,
cfs: I,
error_if_log_file_exist: bool,
) -> Result<Self, Error>
pub fn open_cf_descriptors_read_only<P, I>( opts: &Options, path: P, cfs: I, error_if_log_file_exist: bool, ) -> Result<Self, Error>
Opens a database for ready only with the given database options and column family descriptors.
sourcepub fn open_cf_as_secondary<P, I, N>(
opts: &Options,
primary_path: P,
secondary_path: P,
cfs: I,
) -> Result<Self, Error>
pub fn open_cf_as_secondary<P, I, N>( opts: &Options, primary_path: P, secondary_path: P, cfs: I, ) -> Result<Self, Error>
Opens the database as a secondary with the given database options and column family names.
sourcepub fn open_cf_descriptors_as_secondary<P, I>(
opts: &Options,
path: P,
secondary_path: P,
cfs: I,
) -> Result<Self, Error>
pub fn open_cf_descriptors_as_secondary<P, I>( opts: &Options, path: P, secondary_path: P, cfs: I, ) -> Result<Self, Error>
Opens the database as a secondary with the given database options and column family descriptors.
sourcepub fn open_cf_descriptors<P, I>(
opts: &Options,
path: P,
cfs: I,
) -> Result<Self, Error>
pub fn open_cf_descriptors<P, I>( opts: &Options, path: P, cfs: I, ) -> Result<Self, Error>
Opens a database with the given database options and column family descriptors.
sourcepub fn delete_range_cf_opt<K: AsRef<[u8]>>(
&self,
cf: &impl AsColumnFamilyRef,
from: K,
to: K,
writeopts: &WriteOptions,
) -> Result<(), Error>
pub fn delete_range_cf_opt<K: AsRef<[u8]>>( &self, cf: &impl AsColumnFamilyRef, from: K, to: K, writeopts: &WriteOptions, ) -> Result<(), Error>
Removes the database entries in the range ["from", "to")
using given write options.
sourcepub fn delete_range_cf<K: AsRef<[u8]>>(
&self,
cf: &impl AsColumnFamilyRef,
from: K,
to: K,
) -> Result<(), Error>
pub fn delete_range_cf<K: AsRef<[u8]>>( &self, cf: &impl AsColumnFamilyRef, from: K, to: K, ) -> Result<(), Error>
Removes the database entries in the range ["from", "to")
using default write options.
pub fn write_opt( &self, batch: WriteBatch, writeopts: &WriteOptions, ) -> Result<(), Error>
pub fn write(&self, batch: WriteBatch) -> Result<(), Error>
pub fn write_without_wal(&self, batch: WriteBatch) -> Result<(), Error>
source§impl<T: ThreadMode, D: DBInner> DBCommon<T, D>
impl<T: ThreadMode, D: DBInner> DBCommon<T, D>
Common methods of DBWithThreadMode
and OptimisticTransactionDB
.
pub fn list_cf<P: AsRef<Path>>( opts: &Options, path: P, ) -> Result<Vec<String>, Error>
pub fn destroy<P: AsRef<Path>>(opts: &Options, path: P) -> Result<(), Error>
pub fn repair<P: AsRef<Path>>(opts: &Options, path: P) -> Result<(), Error>
pub fn path(&self) -> &Path
sourcepub fn flush_wal(&self, sync: bool) -> Result<(), Error>
pub fn flush_wal(&self, sync: bool) -> Result<(), Error>
Flushes the WAL buffer. If sync
is set to true
, also syncs
the data to disk.
sourcepub fn flush_opt(&self, flushopts: &FlushOptions) -> Result<(), Error>
pub fn flush_opt(&self, flushopts: &FlushOptions) -> Result<(), Error>
Flushes database memtables to SST files on the disk.
sourcepub fn flush(&self) -> Result<(), Error>
pub fn flush(&self) -> Result<(), Error>
Flushes database memtables to SST files on the disk using default options.
sourcepub fn flush_cf_opt(
&self,
cf: &impl AsColumnFamilyRef,
flushopts: &FlushOptions,
) -> Result<(), Error>
pub fn flush_cf_opt( &self, cf: &impl AsColumnFamilyRef, flushopts: &FlushOptions, ) -> Result<(), Error>
Flushes database memtables to SST files on the disk for a given column family.
sourcepub fn flush_cfs_opt(
&self,
cfs: &[&impl AsColumnFamilyRef],
opts: &FlushOptions,
) -> Result<(), Error>
pub fn flush_cfs_opt( &self, cfs: &[&impl AsColumnFamilyRef], opts: &FlushOptions, ) -> Result<(), Error>
Flushes multiple column families.
If atomic flush is not enabled, it is equivalent to calling flush_cf multiple times.
If atomic flush is enabled, it will flush all column families specified in cfs
up to the latest sequence
number at the time when flush is requested.
sourcepub fn flush_cf(&self, cf: &impl AsColumnFamilyRef) -> Result<(), Error>
pub fn flush_cf(&self, cf: &impl AsColumnFamilyRef) -> Result<(), Error>
Flushes database memtables to SST files on the disk for a given column family using default options.
sourcepub fn get_opt<K: AsRef<[u8]>>(
&self,
key: K,
readopts: &ReadOptions,
) -> Result<Option<Vec<u8>>, Error>
pub fn get_opt<K: AsRef<[u8]>>( &self, key: K, readopts: &ReadOptions, ) -> Result<Option<Vec<u8>>, Error>
Return the bytes associated with a key value with read options. If you only intend to use
the vector returned temporarily, consider using get_pinned_opt
to avoid unnecessary memory copy.
sourcepub fn get<K: AsRef<[u8]>>(&self, key: K) -> Result<Option<Vec<u8>>, Error>
pub fn get<K: AsRef<[u8]>>(&self, key: K) -> Result<Option<Vec<u8>>, Error>
Return the bytes associated with a key value. If you only intend to use the vector returned
temporarily, consider using get_pinned
to avoid unnecessary memory
copy.
sourcepub fn get_cf_opt<K: AsRef<[u8]>>(
&self,
cf: &impl AsColumnFamilyRef,
key: K,
readopts: &ReadOptions,
) -> Result<Option<Vec<u8>>, Error>
pub fn get_cf_opt<K: AsRef<[u8]>>( &self, cf: &impl AsColumnFamilyRef, key: K, readopts: &ReadOptions, ) -> Result<Option<Vec<u8>>, Error>
Return the bytes associated with a key value and the given column family with read options.
If you only intend to use the vector returned temporarily, consider using
get_pinned_cf_opt
to avoid unnecessary memory.
sourcepub fn get_cf<K: AsRef<[u8]>>(
&self,
cf: &impl AsColumnFamilyRef,
key: K,
) -> Result<Option<Vec<u8>>, Error>
pub fn get_cf<K: AsRef<[u8]>>( &self, cf: &impl AsColumnFamilyRef, key: K, ) -> Result<Option<Vec<u8>>, Error>
Return the bytes associated with a key value and the given column family. If you only
intend to use the vector returned temporarily, consider using
get_pinned_cf
to avoid unnecessary memory.
sourcepub fn get_pinned_opt<K: AsRef<[u8]>>(
&self,
key: K,
readopts: &ReadOptions,
) -> Result<Option<DBPinnableSlice<'_>>, Error>
pub fn get_pinned_opt<K: AsRef<[u8]>>( &self, key: K, readopts: &ReadOptions, ) -> Result<Option<DBPinnableSlice<'_>>, Error>
Return the value associated with a key using RocksDB’s PinnableSlice so as to avoid unnecessary memory copy.
sourcepub fn get_pinned<K: AsRef<[u8]>>(
&self,
key: K,
) -> Result<Option<DBPinnableSlice<'_>>, Error>
pub fn get_pinned<K: AsRef<[u8]>>( &self, key: K, ) -> Result<Option<DBPinnableSlice<'_>>, Error>
Return the value associated with a key using RocksDB’s PinnableSlice so as to avoid unnecessary memory copy. Similar to get_pinned_opt but leverages default options.
sourcepub fn get_pinned_cf_opt<K: AsRef<[u8]>>(
&self,
cf: &impl AsColumnFamilyRef,
key: K,
readopts: &ReadOptions,
) -> Result<Option<DBPinnableSlice<'_>>, Error>
pub fn get_pinned_cf_opt<K: AsRef<[u8]>>( &self, cf: &impl AsColumnFamilyRef, key: K, readopts: &ReadOptions, ) -> Result<Option<DBPinnableSlice<'_>>, Error>
Return the value associated with a key using RocksDB’s PinnableSlice so as to avoid unnecessary memory copy. Similar to get_pinned_opt but allows specifying ColumnFamily
sourcepub fn get_pinned_cf<K: AsRef<[u8]>>(
&self,
cf: &impl AsColumnFamilyRef,
key: K,
) -> Result<Option<DBPinnableSlice<'_>>, Error>
pub fn get_pinned_cf<K: AsRef<[u8]>>( &self, cf: &impl AsColumnFamilyRef, key: K, ) -> Result<Option<DBPinnableSlice<'_>>, Error>
Return the value associated with a key using RocksDB’s PinnableSlice so as to avoid unnecessary memory copy. Similar to get_pinned_cf_opt but leverages default options.
sourcepub fn multi_get<K, I>(&self, keys: I) -> Vec<Result<Option<Vec<u8>>, Error>>
pub fn multi_get<K, I>(&self, keys: I) -> Vec<Result<Option<Vec<u8>>, Error>>
Return the values associated with the given keys.
sourcepub fn multi_get_opt<K, I>(
&self,
keys: I,
readopts: &ReadOptions,
) -> Vec<Result<Option<Vec<u8>>, Error>>
pub fn multi_get_opt<K, I>( &self, keys: I, readopts: &ReadOptions, ) -> Vec<Result<Option<Vec<u8>>, Error>>
Return the values associated with the given keys using read options.
sourcepub fn multi_get_cf<'a, 'b: 'a, K, I, W>(
&'a self,
keys: I,
) -> Vec<Result<Option<Vec<u8>>, Error>>
pub fn multi_get_cf<'a, 'b: 'a, K, I, W>( &'a self, keys: I, ) -> Vec<Result<Option<Vec<u8>>, Error>>
Return the values associated with the given keys and column families.
sourcepub fn multi_get_cf_opt<'a, 'b: 'a, K, I, W>(
&'a self,
keys: I,
readopts: &ReadOptions,
) -> Vec<Result<Option<Vec<u8>>, Error>>
pub fn multi_get_cf_opt<'a, 'b: 'a, K, I, W>( &'a self, keys: I, readopts: &ReadOptions, ) -> Vec<Result<Option<Vec<u8>>, Error>>
Return the values associated with the given keys and column families using read options.
sourcepub fn batched_multi_get_cf<'a, K, I>(
&self,
cf: &impl AsColumnFamilyRef,
keys: I,
sorted_input: bool,
) -> Vec<Result<Option<DBPinnableSlice<'_>>, Error>>
pub fn batched_multi_get_cf<'a, K, I>( &self, cf: &impl AsColumnFamilyRef, keys: I, sorted_input: bool, ) -> Vec<Result<Option<DBPinnableSlice<'_>>, Error>>
Return the values associated with the given keys and the specified column family where internally the read requests are processed in batch if block-based table SST format is used. It is a more optimized version of multi_get_cf.
sourcepub fn batched_multi_get_cf_opt<'a, K, I>(
&self,
cf: &impl AsColumnFamilyRef,
keys: I,
sorted_input: bool,
readopts: &ReadOptions,
) -> Vec<Result<Option<DBPinnableSlice<'_>>, Error>>
pub fn batched_multi_get_cf_opt<'a, K, I>( &self, cf: &impl AsColumnFamilyRef, keys: I, sorted_input: bool, readopts: &ReadOptions, ) -> Vec<Result<Option<DBPinnableSlice<'_>>, Error>>
Return the values associated with the given keys and the specified column family where internally the read requests are processed in batch if block-based table SST format is used. It is a more optimized version of multi_get_cf_opt.
sourcepub fn key_may_exist<K: AsRef<[u8]>>(&self, key: K) -> bool
pub fn key_may_exist<K: AsRef<[u8]>>(&self, key: K) -> bool
Returns false
if the given key definitely doesn’t exist in the database, otherwise returns
true
. This function uses default ReadOptions
.
sourcepub fn key_may_exist_opt<K: AsRef<[u8]>>(
&self,
key: K,
readopts: &ReadOptions,
) -> bool
pub fn key_may_exist_opt<K: AsRef<[u8]>>( &self, key: K, readopts: &ReadOptions, ) -> bool
Returns false
if the given key definitely doesn’t exist in the database, otherwise returns
true
.
sourcepub fn key_may_exist_cf<K: AsRef<[u8]>>(
&self,
cf: &impl AsColumnFamilyRef,
key: K,
) -> bool
pub fn key_may_exist_cf<K: AsRef<[u8]>>( &self, cf: &impl AsColumnFamilyRef, key: K, ) -> bool
Returns false
if the given key definitely doesn’t exist in the specified column family,
otherwise returns true
. This function uses default ReadOptions
.
sourcepub fn key_may_exist_cf_opt<K: AsRef<[u8]>>(
&self,
cf: &impl AsColumnFamilyRef,
key: K,
readopts: &ReadOptions,
) -> bool
pub fn key_may_exist_cf_opt<K: AsRef<[u8]>>( &self, cf: &impl AsColumnFamilyRef, key: K, readopts: &ReadOptions, ) -> bool
Returns false
if the given key definitely doesn’t exist in the specified column family,
otherwise returns true
.
sourcepub fn key_may_exist_cf_opt_value<K: AsRef<[u8]>>(
&self,
cf: &impl AsColumnFamilyRef,
key: K,
readopts: &ReadOptions,
) -> (bool, Option<CSlice>)
pub fn key_may_exist_cf_opt_value<K: AsRef<[u8]>>( &self, cf: &impl AsColumnFamilyRef, key: K, readopts: &ReadOptions, ) -> (bool, Option<CSlice>)
If the key definitely does not exist in the database, then this method
returns (false, None)
, else (true, None)
if it may.
If the key is found in memory, then it returns (true, Some<CSlice>)
.
This check is potentially lighter-weight than calling get()
. One way
to make this lighter weight is to avoid doing any IOs.
pub fn iterator<'a: 'b, 'b>( &'a self, mode: IteratorMode<'_>, ) -> DBIteratorWithThreadMode<'b, Self> ⓘ
pub fn iterator_opt<'a: 'b, 'b>( &'a self, mode: IteratorMode<'_>, readopts: ReadOptions, ) -> DBIteratorWithThreadMode<'b, Self> ⓘ
sourcepub fn iterator_cf_opt<'a: 'b, 'b>(
&'a self,
cf_handle: &impl AsColumnFamilyRef,
readopts: ReadOptions,
mode: IteratorMode<'_>,
) -> DBIteratorWithThreadMode<'b, Self> ⓘ
pub fn iterator_cf_opt<'a: 'b, 'b>( &'a self, cf_handle: &impl AsColumnFamilyRef, readopts: ReadOptions, mode: IteratorMode<'_>, ) -> DBIteratorWithThreadMode<'b, Self> ⓘ
Opens an iterator using the provided ReadOptions. This is used when you want to iterate over a specific ColumnFamily with a modified ReadOptions
sourcepub fn full_iterator<'a: 'b, 'b>(
&'a self,
mode: IteratorMode<'_>,
) -> DBIteratorWithThreadMode<'b, Self> ⓘ
pub fn full_iterator<'a: 'b, 'b>( &'a self, mode: IteratorMode<'_>, ) -> DBIteratorWithThreadMode<'b, Self> ⓘ
Opens an iterator with set_total_order_seek
enabled.
This must be used to iterate across prefixes when set_memtable_factory
has been called
with a Hash-based implementation.
pub fn prefix_iterator<'a: 'b, 'b, P: AsRef<[u8]>>( &'a self, prefix: P, ) -> DBIteratorWithThreadMode<'b, Self> ⓘ
pub fn iterator_cf<'a: 'b, 'b>( &'a self, cf_handle: &impl AsColumnFamilyRef, mode: IteratorMode<'_>, ) -> DBIteratorWithThreadMode<'b, Self> ⓘ
pub fn full_iterator_cf<'a: 'b, 'b>( &'a self, cf_handle: &impl AsColumnFamilyRef, mode: IteratorMode<'_>, ) -> DBIteratorWithThreadMode<'b, Self> ⓘ
pub fn prefix_iterator_cf<'a, P: AsRef<[u8]>>( &'a self, cf_handle: &impl AsColumnFamilyRef, prefix: P, ) -> DBIteratorWithThreadMode<'a, Self> ⓘ
sourcepub fn raw_iterator<'a: 'b, 'b>(
&'a self,
) -> DBRawIteratorWithThreadMode<'b, Self>
pub fn raw_iterator<'a: 'b, 'b>( &'a self, ) -> DBRawIteratorWithThreadMode<'b, Self>
Opens a raw iterator over the database, using the default read options
sourcepub fn raw_iterator_cf<'a: 'b, 'b>(
&'a self,
cf_handle: &impl AsColumnFamilyRef,
) -> DBRawIteratorWithThreadMode<'b, Self>
pub fn raw_iterator_cf<'a: 'b, 'b>( &'a self, cf_handle: &impl AsColumnFamilyRef, ) -> DBRawIteratorWithThreadMode<'b, Self>
Opens a raw iterator over the given column family, using the default read options
sourcepub fn raw_iterator_opt<'a: 'b, 'b>(
&'a self,
readopts: ReadOptions,
) -> DBRawIteratorWithThreadMode<'b, Self>
pub fn raw_iterator_opt<'a: 'b, 'b>( &'a self, readopts: ReadOptions, ) -> DBRawIteratorWithThreadMode<'b, Self>
Opens a raw iterator over the database, using the given read options
sourcepub fn raw_iterator_cf_opt<'a: 'b, 'b>(
&'a self,
cf_handle: &impl AsColumnFamilyRef,
readopts: ReadOptions,
) -> DBRawIteratorWithThreadMode<'b, Self>
pub fn raw_iterator_cf_opt<'a: 'b, 'b>( &'a self, cf_handle: &impl AsColumnFamilyRef, readopts: ReadOptions, ) -> DBRawIteratorWithThreadMode<'b, Self>
Opens a raw iterator over the given column family, using the given read options
pub fn snapshot(&self) -> SnapshotWithThreadMode<'_, Self>
pub fn put_opt<K, V>( &self, key: K, value: V, writeopts: &WriteOptions, ) -> Result<(), Error>
pub fn put_cf_opt<K, V>( &self, cf: &impl AsColumnFamilyRef, key: K, value: V, writeopts: &WriteOptions, ) -> Result<(), Error>
pub fn merge_opt<K, V>( &self, key: K, value: V, writeopts: &WriteOptions, ) -> Result<(), Error>
pub fn merge_cf_opt<K, V>( &self, cf: &impl AsColumnFamilyRef, key: K, value: V, writeopts: &WriteOptions, ) -> Result<(), Error>
pub fn delete_opt<K: AsRef<[u8]>>( &self, key: K, writeopts: &WriteOptions, ) -> Result<(), Error>
pub fn delete_cf_opt<K: AsRef<[u8]>>( &self, cf: &impl AsColumnFamilyRef, key: K, writeopts: &WriteOptions, ) -> Result<(), Error>
pub fn put<K, V>(&self, key: K, value: V) -> Result<(), Error>
pub fn put_cf<K, V>( &self, cf: &impl AsColumnFamilyRef, key: K, value: V, ) -> Result<(), Error>
pub fn merge<K, V>(&self, key: K, value: V) -> Result<(), Error>
pub fn merge_cf<K, V>( &self, cf: &impl AsColumnFamilyRef, key: K, value: V, ) -> Result<(), Error>
pub fn delete<K: AsRef<[u8]>>(&self, key: K) -> Result<(), Error>
pub fn delete_cf<K: AsRef<[u8]>>( &self, cf: &impl AsColumnFamilyRef, key: K, ) -> Result<(), Error>
sourcepub fn compact_range<S: AsRef<[u8]>, E: AsRef<[u8]>>(
&self,
start: Option<S>,
end: Option<E>,
)
pub fn compact_range<S: AsRef<[u8]>, E: AsRef<[u8]>>( &self, start: Option<S>, end: Option<E>, )
Runs a manual compaction on the Range of keys given. This is not likely to be needed for typical usage.
sourcepub fn compact_range_opt<S: AsRef<[u8]>, E: AsRef<[u8]>>(
&self,
start: Option<S>,
end: Option<E>,
opts: &CompactOptions,
)
pub fn compact_range_opt<S: AsRef<[u8]>, E: AsRef<[u8]>>( &self, start: Option<S>, end: Option<E>, opts: &CompactOptions, )
Same as compact_range
but with custom options.
sourcepub fn compact_range_cf<S: AsRef<[u8]>, E: AsRef<[u8]>>(
&self,
cf: &impl AsColumnFamilyRef,
start: Option<S>,
end: Option<E>,
)
pub fn compact_range_cf<S: AsRef<[u8]>, E: AsRef<[u8]>>( &self, cf: &impl AsColumnFamilyRef, start: Option<S>, end: Option<E>, )
Runs a manual compaction on the Range of keys given on the given column family. This is not likely to be needed for typical usage.
sourcepub fn compact_range_cf_opt<S: AsRef<[u8]>, E: AsRef<[u8]>>(
&self,
cf: &impl AsColumnFamilyRef,
start: Option<S>,
end: Option<E>,
opts: &CompactOptions,
)
pub fn compact_range_cf_opt<S: AsRef<[u8]>, E: AsRef<[u8]>>( &self, cf: &impl AsColumnFamilyRef, start: Option<S>, end: Option<E>, opts: &CompactOptions, )
Same as compact_range_cf
but with custom options.
sourcepub fn wait_for_compact(
&self,
opts: &WaitForCompactOptions,
) -> Result<(), Error>
pub fn wait_for_compact( &self, opts: &WaitForCompactOptions, ) -> Result<(), Error>
Wait for all flush and compactions jobs to finish. Jobs to wait include the unscheduled (queued, but not scheduled yet).
NOTE: This may also never return if there’s sufficient ongoing writes that keeps flush and compaction going without stopping. The user would have to cease all the writes to DB to make this eventually return in a stable state. The user may also use timeout option in WaitForCompactOptions to make this stop waiting and return when timeout expires.
pub fn set_options(&self, opts: &[(&str, &str)]) -> Result<(), Error>
pub fn set_options_cf( &self, cf: &impl AsColumnFamilyRef, opts: &[(&str, &str)], ) -> Result<(), Error>
sourcepub fn property_value(
&self,
name: impl CStrLike,
) -> Result<Option<String>, Error>
pub fn property_value( &self, name: impl CStrLike, ) -> Result<Option<String>, Error>
Retrieves a RocksDB property by name.
Full list of properties could be find here.
sourcepub fn property_value_cf(
&self,
cf: &impl AsColumnFamilyRef,
name: impl CStrLike,
) -> Result<Option<String>, Error>
pub fn property_value_cf( &self, cf: &impl AsColumnFamilyRef, name: impl CStrLike, ) -> Result<Option<String>, Error>
Retrieves a RocksDB property by name, for a specific column family.
Full list of properties could be find here.
sourcepub fn property_int_value(
&self,
name: impl CStrLike,
) -> Result<Option<u64>, Error>
pub fn property_int_value( &self, name: impl CStrLike, ) -> Result<Option<u64>, Error>
Retrieves a RocksDB property and casts it to an integer.
Full list of properties that return int values could be find here.
sourcepub fn property_int_value_cf(
&self,
cf: &impl AsColumnFamilyRef,
name: impl CStrLike,
) -> Result<Option<u64>, Error>
pub fn property_int_value_cf( &self, cf: &impl AsColumnFamilyRef, name: impl CStrLike, ) -> Result<Option<u64>, Error>
Retrieves a RocksDB property for a specific column family and casts it to an integer.
Full list of properties that return int values could be find here.
sourcepub fn latest_sequence_number(&self) -> u64
pub fn latest_sequence_number(&self) -> u64
The sequence number of the most recent transaction.
sourcepub fn get_updates_since(&self, seq_number: u64) -> Result<DBWALIterator, Error>
pub fn get_updates_since(&self, seq_number: u64) -> Result<DBWALIterator, Error>
Iterate over batches of write operations since a given sequence.
Produce an iterator that will provide the batches of write operations
that have occurred since the given sequence (see
latest_sequence_number()
). Use the provided iterator to retrieve each
(u64
, WriteBatch
) tuple, and then gather the individual puts and
deletes using the WriteBatch::iterate()
function.
Calling get_updates_since()
with a sequence number that is out of
bounds will return an error.
sourcepub fn try_catch_up_with_primary(&self) -> Result<(), Error>
pub fn try_catch_up_with_primary(&self) -> Result<(), Error>
Tries to catch up with the primary by reading as much as possible from the log files.
sourcepub fn ingest_external_file<P: AsRef<Path>>(
&self,
paths: Vec<P>,
) -> Result<(), Error>
pub fn ingest_external_file<P: AsRef<Path>>( &self, paths: Vec<P>, ) -> Result<(), Error>
Loads a list of external SST files created with SstFileWriter into the DB with default opts
sourcepub fn ingest_external_file_opts<P: AsRef<Path>>(
&self,
opts: &IngestExternalFileOptions,
paths: Vec<P>,
) -> Result<(), Error>
pub fn ingest_external_file_opts<P: AsRef<Path>>( &self, opts: &IngestExternalFileOptions, paths: Vec<P>, ) -> Result<(), Error>
Loads a list of external SST files created with SstFileWriter into the DB
sourcepub fn ingest_external_file_cf<P: AsRef<Path>>(
&self,
cf: &impl AsColumnFamilyRef,
paths: Vec<P>,
) -> Result<(), Error>
pub fn ingest_external_file_cf<P: AsRef<Path>>( &self, cf: &impl AsColumnFamilyRef, paths: Vec<P>, ) -> Result<(), Error>
Loads a list of external SST files created with SstFileWriter into the DB for given Column Family with default opts
sourcepub fn ingest_external_file_cf_opts<P: AsRef<Path>>(
&self,
cf: &impl AsColumnFamilyRef,
opts: &IngestExternalFileOptions,
paths: Vec<P>,
) -> Result<(), Error>
pub fn ingest_external_file_cf_opts<P: AsRef<Path>>( &self, cf: &impl AsColumnFamilyRef, opts: &IngestExternalFileOptions, paths: Vec<P>, ) -> Result<(), Error>
Loads a list of external SST files created with SstFileWriter into the DB for given Column Family
sourcepub fn get_column_family_metadata(&self) -> ColumnFamilyMetaData
pub fn get_column_family_metadata(&self) -> ColumnFamilyMetaData
Obtains the LSM-tree meta data of the default column family of the DB
sourcepub fn get_column_family_metadata_cf(
&self,
cf: &impl AsColumnFamilyRef,
) -> ColumnFamilyMetaData
pub fn get_column_family_metadata_cf( &self, cf: &impl AsColumnFamilyRef, ) -> ColumnFamilyMetaData
Obtains the LSM-tree meta data of the specified column family of the DB
sourcepub fn live_files(&self) -> Result<Vec<LiveFile>, Error>
pub fn live_files(&self) -> Result<Vec<LiveFile>, Error>
Returns a list of all table files with their level, start key and end key
sourcepub fn delete_file_in_range<K: AsRef<[u8]>>(
&self,
from: K,
to: K,
) -> Result<(), Error>
pub fn delete_file_in_range<K: AsRef<[u8]>>( &self, from: K, to: K, ) -> Result<(), Error>
Delete sst files whose keys are entirely in the given range.
Could leave some keys in the range which are in files which are not entirely in the range.
Note: L0 files are left regardless of whether they’re in the range.
SnapshotWithThreadModes before the delete might not see the data in the given range.
sourcepub fn delete_file_in_range_cf<K: AsRef<[u8]>>(
&self,
cf: &impl AsColumnFamilyRef,
from: K,
to: K,
) -> Result<(), Error>
pub fn delete_file_in_range_cf<K: AsRef<[u8]>>( &self, cf: &impl AsColumnFamilyRef, from: K, to: K, ) -> Result<(), Error>
Same as delete_file_in_range
but only for specific column family
sourcepub fn cancel_all_background_work(&self, wait: bool)
pub fn cancel_all_background_work(&self, wait: bool)
Request stopping background work, if wait is true wait until it’s done.
source§impl<I: DBInner> DBCommon<SingleThreaded, I>
impl<I: DBInner> DBCommon<SingleThreaded, I>
sourcepub fn create_cf<N: AsRef<str>>(
&mut self,
name: N,
opts: &Options,
) -> Result<(), Error>
pub fn create_cf<N: AsRef<str>>( &mut self, name: N, opts: &Options, ) -> Result<(), Error>
Creates column family with given name and options
sourcepub fn drop_cf(&mut self, name: &str) -> Result<(), Error>
pub fn drop_cf(&mut self, name: &str) -> Result<(), Error>
Drops the column family with the given name
sourcepub fn cf_handle(&self, name: &str) -> Option<&ColumnFamily>
pub fn cf_handle(&self, name: &str) -> Option<&ColumnFamily>
Returns the underlying column family handle
source§impl<I: DBInner> DBCommon<MultiThreaded, I>
impl<I: DBInner> DBCommon<MultiThreaded, I>
sourcepub fn create_cf<N: AsRef<str>>(
&self,
name: N,
opts: &Options,
) -> Result<(), Error>
pub fn create_cf<N: AsRef<str>>( &self, name: N, opts: &Options, ) -> Result<(), Error>
Creates column family with given name and options
source§impl<T: ThreadMode> DBCommon<T, OptimisticTransactionDBInner>
impl<T: ThreadMode> DBCommon<T, OptimisticTransactionDBInner>
Methods of OptimisticTransactionDB
.
sourcepub fn open_default<P: AsRef<Path>>(path: P) -> Result<Self, Error>
pub fn open_default<P: AsRef<Path>>(path: P) -> Result<Self, Error>
Opens a database with default options.
sourcepub fn open<P: AsRef<Path>>(opts: &Options, path: P) -> Result<Self, Error>
pub fn open<P: AsRef<Path>>(opts: &Options, path: P) -> Result<Self, Error>
Opens the database with the specified options.
sourcepub fn open_cf<P, I, N>(opts: &Options, path: P, cfs: I) -> Result<Self, Error>
pub fn open_cf<P, I, N>(opts: &Options, path: P, cfs: I) -> Result<Self, Error>
Opens a database with the given database options and column family names.
Column families opened using this function will be created with default Options
.
sourcepub fn open_cf_descriptors<P, I>(
opts: &Options,
path: P,
cfs: I,
) -> Result<Self, Error>
pub fn open_cf_descriptors<P, I>( opts: &Options, path: P, cfs: I, ) -> Result<Self, Error>
Opens a database with the given database options and column family descriptors.
sourcepub fn transaction(&self) -> Transaction<'_, Self>
pub fn transaction(&self) -> Transaction<'_, Self>
Creates a transaction with default options.
sourcepub fn transaction_opt(
&self,
writeopts: &WriteOptions,
otxn_opts: &OptimisticTransactionOptions,
) -> Transaction<'_, Self>
pub fn transaction_opt( &self, writeopts: &WriteOptions, otxn_opts: &OptimisticTransactionOptions, ) -> Transaction<'_, Self>
Creates a transaction with default options.