pub struct DBCommon<T, D>where
T: ThreadMode,
D: DBInner,{ /* private fields */ }
Expand description
A helper type to implement some common methods for DBWithThreadMode
and OptimisticTransactionDB
.
Implementations§
§impl<T> DBCommon<T, DBWithThreadModeInner>where
T: ThreadMode,
impl<T> DBCommon<T, DBWithThreadModeInner>where
T: ThreadMode,
Methods of DBWithThreadMode
.
pub fn open_default<P>(
path: P,
) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
pub fn open_default<P>( path: P, ) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
Opens a database with default options.
pub fn open<P>(
opts: &Options,
path: P,
) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
pub fn open<P>( opts: &Options, path: P, ) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
Opens the database with the specified options.
pub fn open_for_read_only<P>(
opts: &Options,
path: P,
error_if_log_file_exist: bool,
) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
pub fn open_for_read_only<P>( opts: &Options, path: P, error_if_log_file_exist: bool, ) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
Opens the database for read only with the specified options.
pub fn open_as_secondary<P>(
opts: &Options,
primary_path: P,
secondary_path: P,
) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
pub fn open_as_secondary<P>( opts: &Options, primary_path: P, secondary_path: P, ) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
Opens the database as a secondary.
pub fn open_with_ttl<P>(
opts: &Options,
path: P,
ttl: Duration,
) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
pub fn open_with_ttl<P>( opts: &Options, path: P, ttl: Duration, ) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
Opens the database with a Time to Live compaction filter.
pub fn open_cf_with_ttl<P, I, N>(
opts: &Options,
path: P,
cfs: I,
ttl: Duration,
) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
pub fn open_cf_with_ttl<P, I, N>( opts: &Options, path: P, cfs: I, ttl: Duration, ) -> Result<DBCommon<T, DBWithThreadModeInner>, 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
.
pub fn open_cf_descriptors_with_ttl<P, I>(
opts: &Options,
path: P,
cfs: I,
ttl: Duration,
) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
pub fn open_cf_descriptors_with_ttl<P, I>( opts: &Options, path: P, cfs: I, ttl: Duration, ) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
Opens a database with the given database with a Time to Live compaction filter and column family descriptors.
pub fn open_cf<P, I, N>(
opts: &Options,
path: P,
cfs: I,
) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
pub fn open_cf<P, I, N>( opts: &Options, path: P, cfs: I, ) -> Result<DBCommon<T, DBWithThreadModeInner>, 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
.
pub fn open_cf_with_opts<P, I, N>(
opts: &Options,
path: P,
cfs: I,
) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
pub fn open_cf_with_opts<P, I, N>( opts: &Options, path: P, cfs: I, ) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
Opens a database with the given database options and column family names.
Column families opened using given Options
.
pub fn open_cf_for_read_only<P, I, N>(
opts: &Options,
path: P,
cfs: I,
error_if_log_file_exist: bool,
) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
pub fn open_cf_for_read_only<P, I, N>( opts: &Options, path: P, cfs: I, error_if_log_file_exist: bool, ) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
Opens a database for read only with the given database options and column family names.
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<DBCommon<T, DBWithThreadModeInner>, 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<DBCommon<T, DBWithThreadModeInner>, Error>
Opens a database for read only with the given database options and column family names.
pub fn open_cf_descriptors_read_only<P, I>(
opts: &Options,
path: P,
cfs: I,
error_if_log_file_exist: bool,
) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
pub fn open_cf_descriptors_read_only<P, I>( opts: &Options, path: P, cfs: I, error_if_log_file_exist: bool, ) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
Opens a database for ready only with the given database options and column family descriptors.
pub fn open_cf_as_secondary<P, I, N>(
opts: &Options,
primary_path: P,
secondary_path: P,
cfs: I,
) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
pub fn open_cf_as_secondary<P, I, N>( opts: &Options, primary_path: P, secondary_path: P, cfs: I, ) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
Opens the database as a secondary with the given database options and column family names.
pub fn open_cf_descriptors_as_secondary<P, I>(
opts: &Options,
path: P,
secondary_path: P,
cfs: I,
) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
pub fn open_cf_descriptors_as_secondary<P, I>( opts: &Options, path: P, secondary_path: P, cfs: I, ) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
Opens the database as a secondary with the given database options and column family descriptors.
pub fn open_cf_descriptors<P, I>(
opts: &Options,
path: P,
cfs: I,
) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
pub fn open_cf_descriptors<P, I>( opts: &Options, path: P, cfs: I, ) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
Opens a database with the given database options and column family descriptors.
pub fn delete_range_cf_opt<K>(
&self,
cf: &impl AsColumnFamilyRef,
from: K,
to: K,
writeopts: &WriteOptions,
) -> Result<(), Error>
pub fn delete_range_cf_opt<K>( &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.
pub fn delete_range_cf<K>(
&self,
cf: &impl AsColumnFamilyRef,
from: K,
to: K,
) -> Result<(), Error>
pub fn delete_range_cf<K>( &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: WriteBatchWithTransaction<false>, writeopts: &WriteOptions, ) -> Result<(), Error>
pub fn write( &self, batch: WriteBatchWithTransaction<false>, ) -> Result<(), Error>
pub fn write_without_wal( &self, batch: WriteBatchWithTransaction<false>, ) -> Result<(), Error>
§impl<T, D> DBCommon<T, D>where
T: ThreadMode,
D: DBInner,
impl<T, D> DBCommon<T, D>where
T: ThreadMode,
D: DBInner,
Common methods of DBWithThreadMode
and OptimisticTransactionDB
.
pub fn list_cf<P>(opts: &Options, path: P) -> Result<Vec<String>, Error>
pub fn destroy<P>(opts: &Options, path: P) -> Result<(), Error>
pub fn repair<P>(opts: &Options, path: P) -> Result<(), Error>
pub fn path(&self) -> &Path
pub 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.
pub 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.
pub fn flush(&self) -> Result<(), Error>
pub fn flush(&self) -> Result<(), Error>
Flushes database memtables to SST files on the disk using default options.
pub 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.
pub 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.
pub 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.
pub fn get_opt<K>(
&self,
key: K,
readopts: &ReadOptions,
) -> Result<Option<Vec<u8>>, Error>
pub fn get_opt<K>( &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.
pub fn get<K>(&self, key: K) -> Result<Option<Vec<u8>>, Error>
pub fn get<K>(&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.
pub fn get_cf_opt<K>(
&self,
cf: &impl AsColumnFamilyRef,
key: K,
readopts: &ReadOptions,
) -> Result<Option<Vec<u8>>, Error>
pub fn get_cf_opt<K>( &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.
pub fn get_cf<K>(
&self,
cf: &impl AsColumnFamilyRef,
key: K,
) -> Result<Option<Vec<u8>>, Error>
pub fn get_cf<K>( &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.
pub fn get_pinned_opt<K>(
&self,
key: K,
readopts: &ReadOptions,
) -> Result<Option<DBPinnableSlice<'_>>, Error>
pub fn get_pinned_opt<K>( &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.
pub fn get_pinned<K>(
&self,
key: K,
) -> Result<Option<DBPinnableSlice<'_>>, Error>
pub fn get_pinned<K>( &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.
pub fn get_pinned_cf_opt<K>(
&self,
cf: &impl AsColumnFamilyRef,
key: K,
readopts: &ReadOptions,
) -> Result<Option<DBPinnableSlice<'_>>, Error>
pub fn get_pinned_cf_opt<K>( &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
pub fn get_pinned_cf<K>(
&self,
cf: &impl AsColumnFamilyRef,
key: K,
) -> Result<Option<DBPinnableSlice<'_>>, Error>
pub fn get_pinned_cf<K>( &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.
pub 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.
pub 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.
pub fn multi_get_cf<'a, 'b, K, I, W>(
&'a self,
keys: I,
) -> Vec<Result<Option<Vec<u8>>, Error>>
pub fn multi_get_cf<'a, 'b, K, I, W>( &'a self, keys: I, ) -> Vec<Result<Option<Vec<u8>>, Error>>
Return the values associated with the given keys and column families.
pub fn multi_get_cf_opt<'a, 'b, K, I, W>(
&'a self,
keys: I,
readopts: &ReadOptions,
) -> Vec<Result<Option<Vec<u8>>, Error>>
pub fn multi_get_cf_opt<'a, 'b, 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.
pub 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.
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>>
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.
pub fn key_may_exist<K>(&self, key: K) -> bool
pub fn key_may_exist<K>(&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
.
pub fn key_may_exist_opt<K>(&self, key: K, readopts: &ReadOptions) -> bool
pub fn key_may_exist_opt<K>(&self, key: K, readopts: &ReadOptions) -> bool
Returns false
if the given key definitely doesn’t exist in the database, otherwise returns
true
.
pub fn key_may_exist_cf<K>(&self, cf: &impl AsColumnFamilyRef, key: K) -> bool
pub fn key_may_exist_cf<K>(&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
.
pub fn key_may_exist_cf_opt<K>(
&self,
cf: &impl AsColumnFamilyRef,
key: K,
readopts: &ReadOptions,
) -> bool
pub fn key_may_exist_cf_opt<K>( &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
.
pub fn key_may_exist_cf_opt_value<K>(
&self,
cf: &impl AsColumnFamilyRef,
key: K,
readopts: &ReadOptions,
) -> (bool, Option<CSlice>)
pub fn key_may_exist_cf_opt_value<K>( &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>(
&'a self,
mode: IteratorMode<'_>,
) -> DBIteratorWithThreadMode<'b, DBCommon<T, D>> ⓘwhere
'a: 'b,
pub fn iterator_opt<'a, 'b>(
&'a self,
mode: IteratorMode<'_>,
readopts: ReadOptions,
) -> DBIteratorWithThreadMode<'b, DBCommon<T, D>> ⓘwhere
'a: 'b,
pub fn iterator_cf_opt<'a, 'b>(
&'a self,
cf_handle: &impl AsColumnFamilyRef,
readopts: ReadOptions,
mode: IteratorMode<'_>,
) -> DBIteratorWithThreadMode<'b, DBCommon<T, D>> ⓘwhere
'a: 'b,
pub fn iterator_cf_opt<'a, 'b>(
&'a self,
cf_handle: &impl AsColumnFamilyRef,
readopts: ReadOptions,
mode: IteratorMode<'_>,
) -> DBIteratorWithThreadMode<'b, DBCommon<T, D>> ⓘwhere
'a: 'b,
Opens an iterator using the provided ReadOptions. This is used when you want to iterate over a specific ColumnFamily with a modified ReadOptions
pub fn full_iterator<'a, 'b>(
&'a self,
mode: IteratorMode<'_>,
) -> DBIteratorWithThreadMode<'b, DBCommon<T, D>> ⓘwhere
'a: 'b,
pub fn full_iterator<'a, 'b>(
&'a self,
mode: IteratorMode<'_>,
) -> DBIteratorWithThreadMode<'b, DBCommon<T, D>> ⓘwhere
'a: 'b,
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, P>( &'a self, prefix: P, ) -> DBIteratorWithThreadMode<'b, DBCommon<T, D>> ⓘ
pub fn iterator_cf<'a, 'b>(
&'a self,
cf_handle: &impl AsColumnFamilyRef,
mode: IteratorMode<'_>,
) -> DBIteratorWithThreadMode<'b, DBCommon<T, D>> ⓘwhere
'a: 'b,
pub fn full_iterator_cf<'a, 'b>(
&'a self,
cf_handle: &impl AsColumnFamilyRef,
mode: IteratorMode<'_>,
) -> DBIteratorWithThreadMode<'b, DBCommon<T, D>> ⓘwhere
'a: 'b,
pub fn prefix_iterator_cf<'a, P>( &'a self, cf_handle: &impl AsColumnFamilyRef, prefix: P, ) -> DBIteratorWithThreadMode<'a, DBCommon<T, D>> ⓘ
pub fn raw_iterator<'a, 'b>(
&'a self,
) -> DBRawIteratorWithThreadMode<'b, DBCommon<T, D>>where
'a: 'b,
pub fn raw_iterator<'a, 'b>(
&'a self,
) -> DBRawIteratorWithThreadMode<'b, DBCommon<T, D>>where
'a: 'b,
Opens a raw iterator over the database, using the default read options
pub fn raw_iterator_cf<'a, 'b>(
&'a self,
cf_handle: &impl AsColumnFamilyRef,
) -> DBRawIteratorWithThreadMode<'b, DBCommon<T, D>>where
'a: 'b,
pub fn raw_iterator_cf<'a, 'b>(
&'a self,
cf_handle: &impl AsColumnFamilyRef,
) -> DBRawIteratorWithThreadMode<'b, DBCommon<T, D>>where
'a: 'b,
Opens a raw iterator over the given column family, using the default read options
pub fn raw_iterator_opt<'a, 'b>(
&'a self,
readopts: ReadOptions,
) -> DBRawIteratorWithThreadMode<'b, DBCommon<T, D>>where
'a: 'b,
pub fn raw_iterator_opt<'a, 'b>(
&'a self,
readopts: ReadOptions,
) -> DBRawIteratorWithThreadMode<'b, DBCommon<T, D>>where
'a: 'b,
Opens a raw iterator over the database, using the given read options
pub fn raw_iterator_cf_opt<'a, 'b>(
&'a self,
cf_handle: &impl AsColumnFamilyRef,
readopts: ReadOptions,
) -> DBRawIteratorWithThreadMode<'b, DBCommon<T, D>>where
'a: 'b,
pub fn raw_iterator_cf_opt<'a, 'b>(
&'a self,
cf_handle: &impl AsColumnFamilyRef,
readopts: ReadOptions,
) -> DBRawIteratorWithThreadMode<'b, DBCommon<T, D>>where
'a: 'b,
Opens a raw iterator over the given column family, using the given read options
pub fn snapshot(&self) -> SnapshotWithThreadMode<'_, DBCommon<T, D>>
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>( &self, key: K, writeopts: &WriteOptions, ) -> Result<(), Error>
pub fn delete_cf_opt<K>( &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>(&self, key: K) -> Result<(), Error>
pub fn delete_cf<K>( &self, cf: &impl AsColumnFamilyRef, key: K, ) -> Result<(), Error>
pub fn compact_range<S, E>(&self, start: Option<S>, end: Option<E>)
pub fn compact_range<S, E>(&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.
pub fn compact_range_opt<S, E>(
&self,
start: Option<S>,
end: Option<E>,
opts: &CompactOptions,
)
pub fn compact_range_opt<S, E>( &self, start: Option<S>, end: Option<E>, opts: &CompactOptions, )
Same as compact_range
but with custom options.
pub fn compact_range_cf<S, E>(
&self,
cf: &impl AsColumnFamilyRef,
start: Option<S>,
end: Option<E>,
)
pub fn compact_range_cf<S, E>( &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.
pub fn compact_range_cf_opt<S, E>(
&self,
cf: &impl AsColumnFamilyRef,
start: Option<S>,
end: Option<E>,
opts: &CompactOptions,
)
pub fn compact_range_cf_opt<S, E>( &self, cf: &impl AsColumnFamilyRef, start: Option<S>, end: Option<E>, opts: &CompactOptions, )
Same as compact_range_cf
but with custom options.
pub 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>
pub 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.
pub 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.
pub 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.
pub 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.
pub fn latest_sequence_number(&self) -> u64
pub fn latest_sequence_number(&self) -> u64
The sequence number of the most recent transaction.
pub 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.
pub 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.
pub fn ingest_external_file<P>(&self, paths: Vec<P>) -> Result<(), Error>
pub fn ingest_external_file<P>(&self, paths: Vec<P>) -> Result<(), Error>
Loads a list of external SST files created with SstFileWriter into the DB with default opts
pub fn ingest_external_file_opts<P>(
&self,
opts: &IngestExternalFileOptions,
paths: Vec<P>,
) -> Result<(), Error>
pub fn ingest_external_file_opts<P>( &self, opts: &IngestExternalFileOptions, paths: Vec<P>, ) -> Result<(), Error>
Loads a list of external SST files created with SstFileWriter into the DB
pub fn ingest_external_file_cf<P>(
&self,
cf: &impl AsColumnFamilyRef,
paths: Vec<P>,
) -> Result<(), Error>
pub fn ingest_external_file_cf<P>( &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
pub fn ingest_external_file_cf_opts<P>(
&self,
cf: &impl AsColumnFamilyRef,
opts: &IngestExternalFileOptions,
paths: Vec<P>,
) -> Result<(), Error>
pub fn ingest_external_file_cf_opts<P>( &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
pub 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
pub 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
pub 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
pub fn delete_file_in_range<K>(&self, from: K, to: K) -> Result<(), Error>
pub fn delete_file_in_range<K>(&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.
pub fn delete_file_in_range_cf<K>(
&self,
cf: &impl AsColumnFamilyRef,
from: K,
to: K,
) -> Result<(), Error>
pub fn delete_file_in_range_cf<K>( &self, cf: &impl AsColumnFamilyRef, from: K, to: K, ) -> Result<(), Error>
Same as delete_file_in_range
but only for specific column family
pub 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.
§impl<I> DBCommon<SingleThreaded, I>where
I: DBInner,
impl<I> DBCommon<SingleThreaded, I>where
I: DBInner,
pub fn create_cf<N>(&mut self, name: N, opts: &Options) -> Result<(), Error>
pub fn create_cf<N>(&mut self, name: N, opts: &Options) -> Result<(), Error>
Creates column family with given name and options
pub 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
pub fn cf_handle(&self, name: &str) -> Option<&ColumnFamily>
pub fn cf_handle(&self, name: &str) -> Option<&ColumnFamily>
Returns the underlying column family handle
§impl<I> DBCommon<MultiThreaded, I>where
I: DBInner,
impl<I> DBCommon<MultiThreaded, I>where
I: DBInner,
pub fn create_cf<N>(&self, name: N, opts: &Options) -> Result<(), Error>
pub fn create_cf<N>(&self, name: N, opts: &Options) -> Result<(), Error>
Creates column family with given name and options
pub fn drop_cf(&self, name: &str) -> Result<(), Error>
pub fn drop_cf(&self, name: &str) -> Result<(), Error>
Drops the column family with the given name by internally locking the inner column
family map. This avoids needing &mut self
reference
pub fn cf_handle(&self, name: &str) -> Option<Arc<BoundColumnFamily<'_>>>
pub fn cf_handle(&self, name: &str) -> Option<Arc<BoundColumnFamily<'_>>>
Returns the underlying column family handle
§impl<T> DBCommon<T, OptimisticTransactionDBInner>where
T: ThreadMode,
impl<T> DBCommon<T, OptimisticTransactionDBInner>where
T: ThreadMode,
Methods of OptimisticTransactionDB
.
pub fn open_default<P>(
path: P,
) -> Result<DBCommon<T, OptimisticTransactionDBInner>, Error>
pub fn open_default<P>( path: P, ) -> Result<DBCommon<T, OptimisticTransactionDBInner>, Error>
Opens a database with default options.
pub fn open<P>(
opts: &Options,
path: P,
) -> Result<DBCommon<T, OptimisticTransactionDBInner>, Error>
pub fn open<P>( opts: &Options, path: P, ) -> Result<DBCommon<T, OptimisticTransactionDBInner>, Error>
Opens the database with the specified options.
pub fn open_cf<P, I, N>(
opts: &Options,
path: P,
cfs: I,
) -> Result<DBCommon<T, OptimisticTransactionDBInner>, Error>
pub fn open_cf<P, I, N>( opts: &Options, path: P, cfs: I, ) -> Result<DBCommon<T, OptimisticTransactionDBInner>, 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
.
pub fn open_cf_descriptors<P, I>(
opts: &Options,
path: P,
cfs: I,
) -> Result<DBCommon<T, OptimisticTransactionDBInner>, Error>
pub fn open_cf_descriptors<P, I>( opts: &Options, path: P, cfs: I, ) -> Result<DBCommon<T, OptimisticTransactionDBInner>, Error>
Opens a database with the given database options and column family descriptors.
pub fn transaction(
&self,
) -> Transaction<'_, DBCommon<T, OptimisticTransactionDBInner>>
pub fn transaction( &self, ) -> Transaction<'_, DBCommon<T, OptimisticTransactionDBInner>>
Creates a transaction with default options.
pub fn transaction_opt(
&self,
writeopts: &WriteOptions,
otxn_opts: &OptimisticTransactionOptions,
) -> Transaction<'_, DBCommon<T, OptimisticTransactionDBInner>>
pub fn transaction_opt( &self, writeopts: &WriteOptions, otxn_opts: &OptimisticTransactionOptions, ) -> Transaction<'_, DBCommon<T, OptimisticTransactionDBInner>>
Creates a transaction with default options.