Struct DBCommon

Source
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§

Source§

impl<T> DBCommon<T, DBWithThreadModeInner>
where T: ThreadMode,

Methods of DBWithThreadMode.

Source

pub fn open_default<P>( path: P, ) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
where P: AsRef<Path>,

Opens a database with default options.

Source

pub fn open<P>( opts: &Options, path: P, ) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
where P: AsRef<Path>,

Opens the database with the specified options.

Source

pub fn open_for_read_only<P>( opts: &Options, path: P, error_if_log_file_exist: bool, ) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
where P: AsRef<Path>,

Opens the database for read only with the specified options.

Source

pub fn open_as_secondary<P>( opts: &Options, primary_path: P, secondary_path: P, ) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
where P: AsRef<Path>,

Opens the database as a secondary.

Source

pub fn open_with_ttl<P>( opts: &Options, path: P, ttl: Duration, ) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
where P: AsRef<Path>,

Opens the database with a Time to Live compaction filter.

Source

pub fn open_cf_with_ttl<P, I, N>( opts: &Options, path: P, cfs: I, ttl: Duration, ) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
where P: AsRef<Path>, I: IntoIterator<Item = N>, N: AsRef<str>,

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.

Source

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.

Source

pub fn open_cf<P, I, N>( opts: &Options, path: P, cfs: I, ) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
where P: AsRef<Path>, I: IntoIterator<Item = N>, N: AsRef<str>,

Opens a database with the given database options and column family names.

Column families opened using this function will be created with default Options.

Source

pub fn open_cf_with_opts<P, I, N>( opts: &Options, path: P, cfs: I, ) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
where P: AsRef<Path>, I: IntoIterator<Item = (N, Options)>, N: AsRef<str>,

Opens a database with the given database options and column family names.

Column families opened using given Options.

Source

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>
where P: AsRef<Path>, I: IntoIterator<Item = N>, N: AsRef<str>,

Opens a database for read only with the given database options and column family names.

Source

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>
where P: AsRef<Path>, I: IntoIterator<Item = (N, Options)>, N: AsRef<str>,

Opens a database for read only with the given database options and column family names.

Source

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.

Source

pub fn open_cf_as_secondary<P, I, N>( opts: &Options, primary_path: P, secondary_path: P, cfs: I, ) -> Result<DBCommon<T, DBWithThreadModeInner>, Error>
where P: AsRef<Path>, I: IntoIterator<Item = N>, N: AsRef<str>,

Opens the database as a secondary with the given database options and column family names.

Source

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.

Source

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.

Source

pub fn delete_range_cf_opt<K>( &self, cf: &impl AsColumnFamilyRef, from: K, to: K, writeopts: &WriteOptions, ) -> Result<(), Error>
where K: AsRef<[u8]>,

Removes the database entries in the range ["from", "to") using given write options.

Source

pub fn delete_range_cf<K>( &self, cf: &impl AsColumnFamilyRef, from: K, to: K, ) -> Result<(), Error>
where K: AsRef<[u8]>,

Removes the database entries in the range ["from", "to") using default write options.

Source

pub fn write_opt( &self, batch: WriteBatchWithTransaction<false>, writeopts: &WriteOptions, ) -> Result<(), Error>

Source

pub fn write( &self, batch: WriteBatchWithTransaction<false>, ) -> Result<(), Error>

Source

pub fn write_without_wal( &self, batch: WriteBatchWithTransaction<false>, ) -> Result<(), Error>

Source§

impl<T, D> DBCommon<T, D>
where T: ThreadMode, D: DBInner,

Common methods of DBWithThreadMode and OptimisticTransactionDB.

Source

pub fn list_cf<P>(opts: &Options, path: P) -> Result<Vec<String>, Error>
where P: AsRef<Path>,

Source

pub fn destroy<P>(opts: &Options, path: P) -> Result<(), Error>
where P: AsRef<Path>,

Source

pub fn repair<P>(opts: &Options, path: P) -> Result<(), Error>
where P: AsRef<Path>,

Source

pub fn path(&self) -> &Path

Source

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.

Source

pub fn flush_opt(&self, flushopts: &FlushOptions) -> Result<(), Error>

Flushes database memtables to SST files on the disk.

Source

pub fn flush(&self) -> Result<(), Error>

Flushes database memtables to SST files on the disk using default options.

Source

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.

Source

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.

Source

pub fn get_opt<K>( &self, key: K, readopts: &ReadOptions, ) -> Result<Option<Vec<u8>>, Error>
where K: AsRef<[u8]>,

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.

Source

pub fn get<K>(&self, key: K) -> Result<Option<Vec<u8>>, Error>
where K: AsRef<[u8]>,

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.

Source

pub fn get_cf_opt<K>( &self, cf: &impl AsColumnFamilyRef, key: K, readopts: &ReadOptions, ) -> Result<Option<Vec<u8>>, Error>
where K: AsRef<[u8]>,

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.

Source

pub fn get_cf<K>( &self, cf: &impl AsColumnFamilyRef, key: K, ) -> Result<Option<Vec<u8>>, Error>
where K: AsRef<[u8]>,

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.

Source

pub fn get_pinned_opt<K>( &self, key: K, readopts: &ReadOptions, ) -> Result<Option<DBPinnableSlice<'_>>, Error>
where K: AsRef<[u8]>,

Return the value associated with a key using RocksDB’s PinnableSlice so as to avoid unnecessary memory copy.

Source

pub fn get_pinned<K>( &self, key: K, ) -> Result<Option<DBPinnableSlice<'_>>, Error>
where K: AsRef<[u8]>,

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.

Source

pub fn get_pinned_cf_opt<K>( &self, cf: &impl AsColumnFamilyRef, key: K, readopts: &ReadOptions, ) -> Result<Option<DBPinnableSlice<'_>>, Error>
where K: AsRef<[u8]>,

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

Source

pub fn get_pinned_cf<K>( &self, cf: &impl AsColumnFamilyRef, key: K, ) -> Result<Option<DBPinnableSlice<'_>>, Error>
where K: AsRef<[u8]>,

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.

Source

pub fn multi_get<K, I>(&self, keys: I) -> Vec<Result<Option<Vec<u8>>, Error>>
where K: AsRef<[u8]>, I: IntoIterator<Item = K>,

Return the values associated with the given keys.

Source

pub fn multi_get_opt<K, I>( &self, keys: I, readopts: &ReadOptions, ) -> Vec<Result<Option<Vec<u8>>, Error>>
where K: AsRef<[u8]>, I: IntoIterator<Item = K>,

Return the values associated with the given keys using read options.

Source

pub fn multi_get_cf<'a, 'b, K, I, W>( &'a self, keys: I, ) -> Vec<Result<Option<Vec<u8>>, Error>>
where 'b: 'a, K: AsRef<[u8]>, I: IntoIterator<Item = (&'b W, K)>, W: 'b + AsColumnFamilyRef,

Return the values associated with the given keys and column families.

Source

pub fn multi_get_cf_opt<'a, 'b, K, I, W>( &'a self, keys: I, readopts: &ReadOptions, ) -> Vec<Result<Option<Vec<u8>>, Error>>
where 'b: 'a, K: AsRef<[u8]>, I: IntoIterator<Item = (&'b W, K)>, W: 'b + AsColumnFamilyRef,

Return the values associated with the given keys and column families using read options.

Source

pub fn batched_multi_get_cf<K, I>( &self, cf: &impl AsColumnFamilyRef, keys: I, sorted_input: bool, ) -> Vec<Result<Option<DBPinnableSlice<'_>>, Error>>
where K: AsRef<[u8]>, I: IntoIterator<Item = K>,

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.

Source

pub fn batched_multi_get_cf_opt<K, I>( &self, cf: &impl AsColumnFamilyRef, keys: I, sorted_input: bool, readopts: &ReadOptions, ) -> Vec<Result<Option<DBPinnableSlice<'_>>, Error>>
where K: AsRef<[u8]>, I: IntoIterator<Item = K>,

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.

Source

pub fn key_may_exist<K>(&self, key: K) -> bool
where K: AsRef<[u8]>,

Returns false if the given key definitely doesn’t exist in the database, otherwise returns true. This function uses default ReadOptions.

Source

pub fn key_may_exist_opt<K>(&self, key: K, readopts: &ReadOptions) -> bool
where K: AsRef<[u8]>,

Returns false if the given key definitely doesn’t exist in the database, otherwise returns true.

Source

pub fn key_may_exist_cf<K>(&self, cf: &impl AsColumnFamilyRef, key: K) -> bool
where K: AsRef<[u8]>,

Returns false if the given key definitely doesn’t exist in the specified column family, otherwise returns true. This function uses default ReadOptions.

Source

pub fn key_may_exist_cf_opt<K>( &self, cf: &impl AsColumnFamilyRef, key: K, readopts: &ReadOptions, ) -> bool
where K: AsRef<[u8]>,

Returns false if the given key definitely doesn’t exist in the specified column family, otherwise returns true.

Source

pub fn iterator<'a, 'b>( &'a self, mode: IteratorMode<'_>, ) -> DBIteratorWithThreadMode<'b, DBCommon<T, D>>
where 'a: 'b,

Source

pub fn iterator_opt<'a, 'b>( &'a self, mode: IteratorMode<'_>, readopts: ReadOptions, ) -> DBIteratorWithThreadMode<'b, DBCommon<T, D>>
where 'a: 'b,

Source

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

Source

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.

Source

pub fn prefix_iterator<'a, 'b, P>( &'a self, prefix: P, ) -> DBIteratorWithThreadMode<'b, DBCommon<T, D>>
where 'a: 'b, P: AsRef<[u8]>,

Source

pub fn iterator_cf<'a, 'b>( &'a self, cf_handle: &impl AsColumnFamilyRef, mode: IteratorMode<'_>, ) -> DBIteratorWithThreadMode<'b, DBCommon<T, D>>
where 'a: 'b,

Source

pub fn full_iterator_cf<'a, 'b>( &'a self, cf_handle: &impl AsColumnFamilyRef, mode: IteratorMode<'_>, ) -> DBIteratorWithThreadMode<'b, DBCommon<T, D>>
where 'a: 'b,

Source

pub fn prefix_iterator_cf<'a, P>( &'a self, cf_handle: &impl AsColumnFamilyRef, prefix: P, ) -> DBIteratorWithThreadMode<'a, DBCommon<T, D>>
where P: AsRef<[u8]>,

Source

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

Source

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

Source

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

Source

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

Source

pub fn snapshot(&self) -> SnapshotWithThreadMode<'_, DBCommon<T, D>>

Source

pub fn put_opt<K, V>( &self, key: K, value: V, writeopts: &WriteOptions, ) -> Result<(), Error>
where K: AsRef<[u8]>, V: AsRef<[u8]>,

Source

pub fn put_cf_opt<K, V>( &self, cf: &impl AsColumnFamilyRef, key: K, value: V, writeopts: &WriteOptions, ) -> Result<(), Error>
where K: AsRef<[u8]>, V: AsRef<[u8]>,

Source

pub fn merge_opt<K, V>( &self, key: K, value: V, writeopts: &WriteOptions, ) -> Result<(), Error>
where K: AsRef<[u8]>, V: AsRef<[u8]>,

Source

pub fn merge_cf_opt<K, V>( &self, cf: &impl AsColumnFamilyRef, key: K, value: V, writeopts: &WriteOptions, ) -> Result<(), Error>
where K: AsRef<[u8]>, V: AsRef<[u8]>,

Source

pub fn delete_opt<K>( &self, key: K, writeopts: &WriteOptions, ) -> Result<(), Error>
where K: AsRef<[u8]>,

Source

pub fn delete_cf_opt<K>( &self, cf: &impl AsColumnFamilyRef, key: K, writeopts: &WriteOptions, ) -> Result<(), Error>
where K: AsRef<[u8]>,

Source

pub fn put<K, V>(&self, key: K, value: V) -> Result<(), Error>
where K: AsRef<[u8]>, V: AsRef<[u8]>,

Source

pub fn put_cf<K, V>( &self, cf: &impl AsColumnFamilyRef, key: K, value: V, ) -> Result<(), Error>
where K: AsRef<[u8]>, V: AsRef<[u8]>,

Source

pub fn merge<K, V>(&self, key: K, value: V) -> Result<(), Error>
where K: AsRef<[u8]>, V: AsRef<[u8]>,

Source

pub fn merge_cf<K, V>( &self, cf: &impl AsColumnFamilyRef, key: K, value: V, ) -> Result<(), Error>
where K: AsRef<[u8]>, V: AsRef<[u8]>,

Source

pub fn delete<K>(&self, key: K) -> Result<(), Error>
where K: AsRef<[u8]>,

Source

pub fn delete_cf<K>( &self, cf: &impl AsColumnFamilyRef, key: K, ) -> Result<(), Error>
where K: AsRef<[u8]>,

Source

pub fn compact_range<S, E>(&self, start: Option<S>, end: Option<E>)
where S: AsRef<[u8]>, E: AsRef<[u8]>,

Runs a manual compaction on the Range of keys given. This is not likely to be needed for typical usage.

Source

pub fn compact_range_opt<S, E>( &self, start: Option<S>, end: Option<E>, opts: &CompactOptions, )
where S: AsRef<[u8]>, E: AsRef<[u8]>,

Same as compact_range but with custom options.

Source

pub fn compact_range_cf<S, E>( &self, cf: &impl AsColumnFamilyRef, start: Option<S>, end: Option<E>, )
where S: AsRef<[u8]>, E: AsRef<[u8]>,

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.

Source

pub fn compact_range_cf_opt<S, E>( &self, cf: &impl AsColumnFamilyRef, start: Option<S>, end: Option<E>, opts: &CompactOptions, )
where S: AsRef<[u8]>, E: AsRef<[u8]>,

Same as compact_range_cf but with custom options.

Source

pub fn set_options(&self, opts: &[(&str, &str)]) -> Result<(), Error>

Source

pub fn set_options_cf( &self, cf: &impl AsColumnFamilyRef, opts: &[(&str, &str)], ) -> Result<(), Error>

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn latest_sequence_number(&self) -> u64

The sequence number of the most recent transaction.

Source

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.

Source

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.

Source

pub fn ingest_external_file<P>(&self, paths: Vec<P>) -> Result<(), Error>
where P: AsRef<Path>,

Loads a list of external SST files created with SstFileWriter into the DB with default opts

Source

pub fn ingest_external_file_opts<P>( &self, opts: &IngestExternalFileOptions, paths: Vec<P>, ) -> Result<(), Error>
where P: AsRef<Path>,

Loads a list of external SST files created with SstFileWriter into the DB

Source

pub fn ingest_external_file_cf<P>( &self, cf: &impl AsColumnFamilyRef, paths: Vec<P>, ) -> Result<(), Error>
where P: AsRef<Path>,

Loads a list of external SST files created with SstFileWriter into the DB for given Column Family with default opts

Source

pub fn ingest_external_file_cf_opts<P>( &self, cf: &impl AsColumnFamilyRef, opts: &IngestExternalFileOptions, paths: Vec<P>, ) -> Result<(), Error>
where P: AsRef<Path>,

Loads a list of external SST files created with SstFileWriter into the DB for given Column Family

Source

pub fn live_files(&self) -> Result<Vec<LiveFile>, Error>

Returns a list of all table files with their level, start key and end key

Source

pub fn delete_file_in_range<K>(&self, from: K, to: K) -> Result<(), Error>
where K: AsRef<[u8]>,

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.

Source

pub fn delete_file_in_range_cf<K>( &self, cf: &impl AsColumnFamilyRef, from: K, to: K, ) -> Result<(), Error>
where K: AsRef<[u8]>,

Same as delete_file_in_range but only for specific column family

Source

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> DBCommon<SingleThreaded, I>
where I: DBInner,

Source

pub fn create_cf<N>(&mut self, name: N, opts: &Options) -> Result<(), Error>
where N: AsRef<str>,

Creates column family with given name and options

Source

pub fn drop_cf(&mut self, name: &str) -> Result<(), Error>

Drops the column family with the given name

Source

pub fn cf_handle(&self, name: &str) -> Option<&ColumnFamily>

Returns the underlying column family handle

Source§

impl<I> DBCommon<MultiThreaded, I>
where I: DBInner,

Source

pub fn create_cf<N>(&self, name: N, opts: &Options) -> Result<(), Error>
where N: AsRef<str>,

Creates column family with given name and options

Source

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

Source

pub fn cf_handle(&self, name: &str) -> Option<Arc<BoundColumnFamily<'_>>>

Returns the underlying column family handle

Source§

impl<T> DBCommon<T, OptimisticTransactionDBInner>
where T: ThreadMode,

Methods of OptimisticTransactionDB.

Source

pub fn open_default<P>( path: P, ) -> Result<DBCommon<T, OptimisticTransactionDBInner>, Error>
where P: AsRef<Path>,

Opens a database with default options.

Source

pub fn open<P>( opts: &Options, path: P, ) -> Result<DBCommon<T, OptimisticTransactionDBInner>, Error>
where P: AsRef<Path>,

Opens the database with the specified options.

Source

pub fn open_cf<P, I, N>( opts: &Options, path: P, cfs: I, ) -> Result<DBCommon<T, OptimisticTransactionDBInner>, Error>
where P: AsRef<Path>, I: IntoIterator<Item = N>, N: AsRef<str>,

Opens a database with the given database options and column family names.

Column families opened using this function will be created with default Options.

Source

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.

Source

pub fn transaction( &self, ) -> Transaction<'_, DBCommon<T, OptimisticTransactionDBInner>>

Creates a transaction with default options.

Source

pub fn transaction_opt( &self, writeopts: &WriteOptions, otxn_opts: &OptimisticTransactionOptions, ) -> Transaction<'_, DBCommon<T, OptimisticTransactionDBInner>>

Creates a transaction with default options.

Source

pub fn write_opt( &self, batch: WriteBatchWithTransaction<true>, writeopts: &WriteOptions, ) -> Result<(), Error>

Source

pub fn write(&self, batch: WriteBatchWithTransaction<true>) -> Result<(), Error>

Source

pub fn write_without_wal( &self, batch: WriteBatchWithTransaction<true>, ) -> Result<(), Error>

Trait Implementations§

Source§

impl<T, D> DBAccess for DBCommon<T, D>
where T: ThreadMode, D: DBInner,

Source§

unsafe fn create_snapshot(&self) -> *const rocksdb_snapshot_t

Source§

unsafe fn release_snapshot(&self, snapshot: *const rocksdb_snapshot_t)

Source§

unsafe fn create_iterator( &self, readopts: &ReadOptions, ) -> *mut rocksdb_iterator_t

Source§

unsafe fn create_iterator_cf( &self, cf_handle: *mut rocksdb_column_family_handle_t, readopts: &ReadOptions, ) -> *mut rocksdb_iterator_t

Source§

fn get_opt<K>( &self, key: K, readopts: &ReadOptions, ) -> Result<Option<Vec<u8>>, Error>
where K: AsRef<[u8]>,

Source§

fn get_cf_opt<K>( &self, cf: &impl AsColumnFamilyRef, key: K, readopts: &ReadOptions, ) -> Result<Option<Vec<u8>>, Error>
where K: AsRef<[u8]>,

Source§

fn get_pinned_opt<K>( &self, key: K, readopts: &ReadOptions, ) -> Result<Option<DBPinnableSlice<'_>>, Error>
where K: AsRef<[u8]>,

Source§

fn get_pinned_cf_opt<K>( &self, cf: &impl AsColumnFamilyRef, key: K, readopts: &ReadOptions, ) -> Result<Option<DBPinnableSlice<'_>>, Error>
where K: AsRef<[u8]>,

Source§

fn multi_get_opt<K, Iter>( &self, keys: Iter, readopts: &ReadOptions, ) -> Vec<Result<Option<Vec<u8>>, Error>>
where K: AsRef<[u8]>, Iter: IntoIterator<Item = K>,

Source§

fn multi_get_cf_opt<'b, K, Iter, W>( &self, keys_cf: Iter, readopts: &ReadOptions, ) -> Vec<Result<Option<Vec<u8>>, Error>>
where K: AsRef<[u8]>, Iter: IntoIterator<Item = (&'b W, K)>, W: AsColumnFamilyRef + 'b,

Source§

impl<T, I> Debug for DBCommon<T, I>
where T: ThreadMode, I: DBInner,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<T, I> Drop for DBCommon<T, I>
where T: ThreadMode, I: DBInner,

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<T, I> Send for DBCommon<T, I>
where T: ThreadMode + Send, I: DBInner,

Source§

impl<T, I> Sync for DBCommon<T, I>
where T: ThreadMode, I: DBInner,

Auto Trait Implementations§

§

impl<T, D> Freeze for DBCommon<T, D>
where D: Freeze, T: Freeze,

§

impl<T, D> RefUnwindSafe for DBCommon<T, D>

§

impl<T, D> Unpin for DBCommon<T, D>
where D: Unpin, T: Unpin,

§

impl<T, D> UnwindSafe for DBCommon<T, D>
where D: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.