[][src]Struct rocksdb::DB

pub struct DB { /* fields omitted */ }

A RocksDB database.

See crate level documentation for a simple usage example.

Methods

impl DB[src]

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

Opens a database with default options.

pub fn open<P: AsRef<Path>>(opts: &Options, path: P) -> Result<DB, 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<DB, 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<DB, Error>
[src]

Opens the database as a secondary.

pub fn open_cf<P, I, N>(opts: &Options, path: P, cfs: I) -> Result<DB, 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<DB, 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<DB, 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<DB, 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: &ColumnFamily,
    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: &ColumnFamily) -> 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: &ColumnFamily,
    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: &ColumnFamily,
    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: &ColumnFamily,
    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: &ColumnFamily,
    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 create_cf<N: AsRef<str>>(
    &mut self,
    name: N,
    opts: &Options
) -> Result<(), Error>
[src]

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

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

Return the underlying column family handle.

pub fn iterator<'a: 'b, 'b>(&'a self, mode: IteratorMode) -> DBIterator<'b>[src]

pub fn iterator_opt<'a: 'b, 'b>(
    &'a self,
    mode: IteratorMode,
    readopts: ReadOptions
) -> DBIterator<'b>
[src]

pub fn iterator_cf_opt<'a: 'b, 'b>(
    &'a self,
    cf_handle: &ColumnFamily,
    readopts: ReadOptions,
    mode: IteratorMode
) -> DBIterator<'b>
[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) -> DBIterator<'b>[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
) -> DBIterator<'b>
[src]

pub fn iterator_cf<'a: 'b, 'b>(
    &'a self,
    cf_handle: &ColumnFamily,
    mode: IteratorMode
) -> DBIterator<'b>
[src]

pub fn full_iterator_cf<'a: 'b, 'b>(
    &'a self,
    cf_handle: &ColumnFamily,
    mode: IteratorMode
) -> DBIterator<'b>
[src]

pub fn prefix_iterator_cf<'a: 'b, 'b, P: AsRef<[u8]>>(
    &'a self,
    cf_handle: &ColumnFamily,
    prefix: P
) -> DBIterator<'b>
[src]

pub fn raw_iterator<'a: 'b, 'b>(&'a self) -> DBRawIterator<'b>[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: &ColumnFamily
) -> DBRawIterator<'b>
[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
) -> DBRawIterator<'b>
[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: &ColumnFamily,
    readopts: ReadOptions
) -> DBRawIterator<'b>
[src]

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

pub fn snapshot(&self) -> Snapshot[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: &ColumnFamily,
    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: &ColumnFamily,
    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: &ColumnFamily,
    key: K,
    writeopts: &WriteOptions
) -> Result<(), Error>
[src]

pub fn delete_range_cf_opt<K: AsRef<[u8]>>(
    &self,
    cf: &ColumnFamily,
    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: &ColumnFamily,
    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: &ColumnFamily,
    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: &ColumnFamily,
    key: K
) -> Result<(), Error>
[src]

pub fn delete_range_cf<K: AsRef<[u8]>>(
    &self,
    cf: &ColumnFamily,
    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]

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

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

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

Retrieves a RocksDB property by name.

For a full list of properties, see https://github.com/facebook/rocksdb/blob/08809f5e6cd9cc4bc3958dd4d59457ae78c76660/include/rocksdb/db.h#L428-L634

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

Retrieves a RocksDB property by name, for a specific column family.

For a full list of properties, see https://github.com/facebook/rocksdb/blob/08809f5e6cd9cc4bc3958dd4d59457ae78c76660/include/rocksdb/db.h#L428-L634

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

Retrieves a RocksDB property and casts it to an integer.

For a full list of properties that return int values, see https://github.com/facebook/rocksdb/blob/08809f5e6cd9cc4bc3958dd4d59457ae78c76660/include/rocksdb/db.h#L654-L689

pub fn property_int_value_cf(
    &self,
    cf: &ColumnFamily,
    name: &str
) -> Result<Option<u64>, Error>
[src]

Retrieves a RocksDB property for a specific column family and casts it to an integer.

For a full list of properties that return int values, see https://github.com/facebook/rocksdb/blob/08809f5e6cd9cc4bc3958dd4d59457ae78c76660/include/rocksdb/db.h#L654-L689

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.

Trait Implementations

impl Debug for DB[src]

impl Drop for DB[src]

impl Send for DB[src]

impl Sync for DB[src]

Auto Trait Implementations

impl RefUnwindSafe for DB

impl Unpin for DB

impl UnwindSafe for DB

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.