Struct rocksdb::DBWithThreadMode[][src]

pub struct DBWithThreadMode<T: ThreadMode> { /* fields omitted */ }

A RocksDB database.

See crate level documentation for a simple usage example.

Implementations

impl<T: ThreadMode> DBWithThreadMode<T>[src]

pub fn open_default<P: AsRef<Path>>(path: P) -> Result<Self, Error>[src]

Opens a database with default options.

pub fn open<P: AsRef<Path>>(opts: &Options, path: P) -> Result<Self, Error>[src]

Opens the database with the specified options.

pub fn open_for_read_only<P: AsRef<Path>>(
    opts: &Options,
    path: P,
    error_if_log_file_exist: bool
) -> Result<Self, Error>
[src]

Opens the database for read only with the specified options.

pub fn open_as_secondary<P: AsRef<Path>>(
    opts: &Options,
    primary_path: P,
    secondary_path: P
) -> Result<Self, Error>
[src]

Opens the database as a secondary.

pub fn open_with_ttl<P: AsRef<Path>>(
    opts: &Options,
    path: P,
    ttl: Duration
) -> Result<Self, Error>
[src]

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

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<Self, Error> where
    P: AsRef<Path>,
    I: IntoIterator<Item = ColumnFamilyDescriptor>, 
[src]

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

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_for_read_only<P, I, N>(
    opts: &Options,
    path: P,
    cfs: I,
    error_if_log_file_exist: bool
) -> Result<Self, Error> where
    P: AsRef<Path>,
    I: IntoIterator<Item = N>,
    N: AsRef<str>, 
[src]

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

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

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

pub fn open_cf_descriptors<P, I>(
    opts: &Options,
    path: P,
    cfs: I
) -> Result<Self, Error> where
    P: AsRef<Path>,
    I: IntoIterator<Item = ColumnFamilyDescriptor>, 
[src]

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

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

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

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

pub fn path(&self) -> &Path[src]

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

Flushes database memtables to SST files on the disk.

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

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>
[src]

Flushes database memtables to SST files on the disk for a given column family.

pub fn flush_cf(&self, cf: impl AsColumnFamilyRef) -> Result<(), Error>[src]

Flushes database memtables to SST files on the disk for a given column family using default options.

pub fn write_opt(
    &self,
    batch: WriteBatch,
    writeopts: &WriteOptions
) -> Result<(), Error>
[src]

pub fn write(&self, batch: WriteBatch) -> Result<(), Error>[src]

pub fn write_without_wal(&self, batch: WriteBatch) -> Result<(), Error>[src]

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

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: AsRef<[u8]>>(&self, key: K) -> Result<Option<Vec<u8>>, Error>[src]

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: AsRef<[u8]>>(
    &self,
    cf: impl AsColumnFamilyRef,
    key: K,
    readopts: &ReadOptions
) -> Result<Option<Vec<u8>>, Error>
[src]

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: AsRef<[u8]>>(
    &self,
    cf: impl AsColumnFamilyRef,
    key: K
) -> Result<Option<Vec<u8>>, Error>
[src]

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: AsRef<[u8]>>(
    &self,
    key: K,
    readopts: &ReadOptions
) -> Result<Option<DBPinnableSlice<'_>>, Error>
[src]

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

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

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: AsRef<[u8]>>(
    &self,
    cf: impl AsColumnFamilyRef,
    key: K,
    readopts: &ReadOptions
) -> Result<Option<DBPinnableSlice<'_>>, Error>
[src]

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: AsRef<[u8]>>(
    &self,
    cf: impl AsColumnFamilyRef,
    key: K
) -> Result<Option<DBPinnableSlice<'_>>, Error>
[src]

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) -> Result<Vec<Vec<u8>>, Error> where
    K: AsRef<[u8]>,
    I: IntoIterator<Item = K>, 
[src]

Return the values associated with the given keys.

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

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

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

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

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

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

pub fn iterator<'a: 'b, 'b>(
    &'a self,
    mode: IteratorMode<'_>
) -> DBIteratorWithThreadMode<'b, Self>

Notable traits for DBIteratorWithThreadMode<'a, D>

impl<'a, D: DBAccess> Iterator for DBIteratorWithThreadMode<'a, D> type Item = (Box<[u8]>, Box<[u8]>);
[src]

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

Notable traits for DBIteratorWithThreadMode<'a, D>

impl<'a, D: DBAccess> Iterator for DBIteratorWithThreadMode<'a, D> type Item = (Box<[u8]>, Box<[u8]>);
[src]

pub fn iterator_cf_opt<'a: 'b, 'b>(
    &'a self,
    cf_handle: impl AsColumnFamilyRef,
    readopts: ReadOptions,
    mode: IteratorMode<'_>
) -> DBIteratorWithThreadMode<'b, Self>

Notable traits for DBIteratorWithThreadMode<'a, D>

impl<'a, D: DBAccess> Iterator for DBIteratorWithThreadMode<'a, D> type Item = (Box<[u8]>, Box<[u8]>);
[src]

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, 'b>(
    &'a self,
    mode: IteratorMode<'_>
) -> DBIteratorWithThreadMode<'b, Self>

Notable traits for DBIteratorWithThreadMode<'a, D>

impl<'a, D: DBAccess> Iterator for DBIteratorWithThreadMode<'a, D> type Item = (Box<[u8]>, Box<[u8]>);
[src]

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>

Notable traits for DBIteratorWithThreadMode<'a, D>

impl<'a, D: DBAccess> Iterator for DBIteratorWithThreadMode<'a, D> type Item = (Box<[u8]>, Box<[u8]>);
[src]

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

Notable traits for DBIteratorWithThreadMode<'a, D>

impl<'a, D: DBAccess> Iterator for DBIteratorWithThreadMode<'a, D> type Item = (Box<[u8]>, Box<[u8]>);
[src]

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

Notable traits for DBIteratorWithThreadMode<'a, D>

impl<'a, D: DBAccess> Iterator for DBIteratorWithThreadMode<'a, D> type Item = (Box<[u8]>, Box<[u8]>);
[src]

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

Notable traits for DBIteratorWithThreadMode<'a, D>

impl<'a, D: DBAccess> Iterator for DBIteratorWithThreadMode<'a, D> type Item = (Box<[u8]>, Box<[u8]>);
[src]

pub fn raw_iterator<'a: 'b, 'b>(
    &'a self
) -> DBRawIteratorWithThreadMode<'b, Self>
[src]

Opens a raw iterator over the database, using the default read options

pub fn raw_iterator_cf<'a: 'b, 'b>(
    &'a self,
    cf_handle: impl AsColumnFamilyRef
) -> DBRawIteratorWithThreadMode<'b, Self>
[src]

Opens a raw iterator over the given column family, using the default read options

pub fn raw_iterator_opt<'a: 'b, 'b>(
    &'a self,
    readopts: ReadOptions
) -> DBRawIteratorWithThreadMode<'b, Self>
[src]

Opens a raw iterator over the database, using the given read options

pub fn raw_iterator_cf_opt<'a: 'b, 'b>(
    &'a self,
    cf_handle: impl AsColumnFamilyRef,
    readopts: ReadOptions
) -> DBRawIteratorWithThreadMode<'b, Self>
[src]

Opens a raw iterator over the given column family, using the given read options

pub fn snapshot(&self) -> SnapshotWithThreadMode<'_, Self>[src]

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

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]>, 
[src]

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

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]>, 
[src]

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

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

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

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

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

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

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

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

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

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

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

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

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

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: AsRef<[u8]>, E: AsRef<[u8]>>(
    &self,
    start: Option<S>,
    end: Option<E>,
    opts: &CompactOptions
)
[src]

Same as compact_range but with custom options.

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

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: AsRef<[u8]>, E: AsRef<[u8]>>(
    &self,
    cf: impl AsColumnFamilyRef,
    start: Option<S>,
    end: Option<E>,
    opts: &CompactOptions
)
[src]

Same as compact_range_cf but with custom options.

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

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

pub fn property_value(&self, name: &str) -> Result<Option<String>, Error>[src]

Retrieves a RocksDB property by name.

Full list of properties could be find here.

pub fn property_value_cf(
    &self,
    cf: impl AsColumnFamilyRef,
    name: &str
) -> Result<Option<String>, Error>
[src]

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: &str) -> Result<Option<u64>, Error>[src]

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: &str
) -> Result<Option<u64>, Error>
[src]

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[src]

The sequence number of the most recent transaction.

pub fn get_updates_since(&self, seq_number: u64) -> Result<DBWALIterator, Error>[src]

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>[src]

Tries to catch up with the primary by reading as much as possible from the log files.

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

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

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

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

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

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: AsRef<Path>>(
    &self,
    cf: impl AsColumnFamilyRef,
    opts: &IngestExternalFileOptions,
    paths: Vec<P>
) -> Result<(), Error>
[src]

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

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

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

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

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: AsRef<[u8]>>(
    &self,
    cf: impl AsColumnFamilyRef,
    from: K,
    to: K
) -> Result<(), Error>
[src]

Same as delete_file_in_range but only for specific column family

pub fn cancel_all_background_work(&self, wait: bool)[src]

Request stopping background work, if wait is true wait until it’s done.

impl DBWithThreadMode<SingleThreaded>[src]

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

Creates column family with given name and options

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

Drops the column family with the given name

pub fn cf_handle<'a>(&'a self, name: &str) -> Option<&'a ColumnFamily>[src]

Returns the underlying column family handle

impl DBWithThreadMode<MultiThreaded>[src]

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

Creates column family with given name and options

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

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<BoundColumnFamily<'_>>[src]

Returns the underlying column family handle

Trait Implementations

impl<T: ThreadMode> Debug for DBWithThreadMode<T>[src]

impl<T: ThreadMode> Drop for DBWithThreadMode<T>[src]

impl<T: ThreadMode> Send for DBWithThreadMode<T>[src]

impl<T: ThreadMode> Sync for DBWithThreadMode<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for DBWithThreadMode<T> where
    T: RefUnwindSafe

impl<T> Unpin for DBWithThreadMode<T> where
    T: Unpin

impl<T> UnwindSafe for DBWithThreadMode<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.