Struct rocksdb::SnapshotWithThreadMode
source · [−]pub struct SnapshotWithThreadMode<'a, D: DBAccess> { /* private fields */ }
Expand description
A consistent view of the database at the point of creation.
Examples
use rocksdb::{DB, IteratorMode, Options};
let path = "_path_for_rocksdb_storage3";
{
let db = DB::open_default(path).unwrap();
let snapshot = db.snapshot(); // Creates a longer-term snapshot of the DB, but closed when goes out of scope
let mut iter = snapshot.iterator(IteratorMode::Start); // Make as many iterators as you'd like from one snapshot
}
let _ = DB::destroy(&Options::default(), path);
Implementations
sourceimpl<'a, D: DBAccess> SnapshotWithThreadMode<'a, D>
impl<'a, D: DBAccess> SnapshotWithThreadMode<'a, D>
sourcepub fn iterator(
&self,
mode: IteratorMode<'_>
) -> DBIteratorWithThreadMode<'a, D>ⓘNotable traits for DBIteratorWithThreadMode<'a, D>impl<'a, D: DBAccess> Iterator for DBIteratorWithThreadMode<'a, D> type Item = (Box<[u8]>, Box<[u8]>);
pub fn iterator(
&self,
mode: IteratorMode<'_>
) -> DBIteratorWithThreadMode<'a, D>ⓘNotable traits for DBIteratorWithThreadMode<'a, D>impl<'a, D: DBAccess> Iterator for DBIteratorWithThreadMode<'a, D> type Item = (Box<[u8]>, Box<[u8]>);
Creates an iterator over the data in this snapshot, using the default read options.
sourcepub fn iterator_cf(
&self,
cf_handle: impl AsColumnFamilyRef,
mode: IteratorMode<'_>
) -> DBIteratorWithThreadMode<'_, D>ⓘNotable traits for DBIteratorWithThreadMode<'a, D>impl<'a, D: DBAccess> Iterator for DBIteratorWithThreadMode<'a, D> type Item = (Box<[u8]>, Box<[u8]>);
pub fn iterator_cf(
&self,
cf_handle: impl AsColumnFamilyRef,
mode: IteratorMode<'_>
) -> DBIteratorWithThreadMode<'_, D>ⓘNotable traits for DBIteratorWithThreadMode<'a, D>impl<'a, D: DBAccess> Iterator for DBIteratorWithThreadMode<'a, D> type Item = (Box<[u8]>, Box<[u8]>);
Creates an iterator over the data in this snapshot under the given column family, using the default read options.
sourcepub fn iterator_opt(
&self,
mode: IteratorMode<'_>,
readopts: ReadOptions
) -> DBIteratorWithThreadMode<'a, D>ⓘNotable traits for DBIteratorWithThreadMode<'a, D>impl<'a, D: DBAccess> Iterator for DBIteratorWithThreadMode<'a, D> type Item = (Box<[u8]>, Box<[u8]>);
pub fn iterator_opt(
&self,
mode: IteratorMode<'_>,
readopts: ReadOptions
) -> DBIteratorWithThreadMode<'a, D>ⓘNotable traits for DBIteratorWithThreadMode<'a, D>impl<'a, D: DBAccess> Iterator for DBIteratorWithThreadMode<'a, D> type Item = (Box<[u8]>, Box<[u8]>);
Creates an iterator over the data in this snapshot, using the given read options.
sourcepub fn iterator_cf_opt(
&self,
cf_handle: impl AsColumnFamilyRef,
readopts: ReadOptions,
mode: IteratorMode<'_>
) -> DBIteratorWithThreadMode<'_, D>ⓘNotable traits for DBIteratorWithThreadMode<'a, D>impl<'a, D: DBAccess> Iterator for DBIteratorWithThreadMode<'a, D> type Item = (Box<[u8]>, Box<[u8]>);
pub fn iterator_cf_opt(
&self,
cf_handle: impl AsColumnFamilyRef,
readopts: ReadOptions,
mode: IteratorMode<'_>
) -> DBIteratorWithThreadMode<'_, D>ⓘNotable traits for DBIteratorWithThreadMode<'a, D>impl<'a, D: DBAccess> Iterator for DBIteratorWithThreadMode<'a, D> type Item = (Box<[u8]>, Box<[u8]>);
Creates an iterator over the data in this snapshot under the given column family, using the given read options.
sourcepub fn raw_iterator(&self) -> DBRawIteratorWithThreadMode<'_, D>
pub fn raw_iterator(&self) -> DBRawIteratorWithThreadMode<'_, D>
Creates a raw iterator over the data in this snapshot, using the default read options.
sourcepub fn raw_iterator_cf(
&self,
cf_handle: impl AsColumnFamilyRef
) -> DBRawIteratorWithThreadMode<'_, D>
pub fn raw_iterator_cf(
&self,
cf_handle: impl AsColumnFamilyRef
) -> DBRawIteratorWithThreadMode<'_, D>
Creates a raw iterator over the data in this snapshot under the given column family, using the default read options.
sourcepub fn raw_iterator_opt(
&self,
readopts: ReadOptions
) -> DBRawIteratorWithThreadMode<'_, D>
pub fn raw_iterator_opt(
&self,
readopts: ReadOptions
) -> DBRawIteratorWithThreadMode<'_, D>
Creates a raw iterator over the data in this snapshot, using the given read options.
sourcepub fn raw_iterator_cf_opt(
&self,
cf_handle: impl AsColumnFamilyRef,
readopts: ReadOptions
) -> DBRawIteratorWithThreadMode<'_, D>
pub fn raw_iterator_cf_opt(
&self,
cf_handle: impl AsColumnFamilyRef,
readopts: ReadOptions
) -> DBRawIteratorWithThreadMode<'_, D>
Creates a raw iterator over the data in this snapshot under the given column family, using the given read options.
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>
Returns the bytes associated with a key value with default read options.
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>
Returns the bytes associated with a key value and given column family with default read 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>
Returns the bytes associated with a key value and given read options.
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>
Returns the bytes associated with a key value, given column family and read options.
Trait Implementations
sourceimpl<'a, D: DBAccess> Drop for SnapshotWithThreadMode<'a, D>
impl<'a, D: DBAccess> Drop for SnapshotWithThreadMode<'a, D>
impl<'a, D: DBAccess> Send for SnapshotWithThreadMode<'a, D>
Send
and Sync
implementations for SnapshotWithThreadMode
are safe, because SnapshotWithThreadMode
is
immutable and can be safely shared between threads.
impl<'a, D: DBAccess> Sync for SnapshotWithThreadMode<'a, D>
Auto Trait Implementations
impl<'a, D> RefUnwindSafe for SnapshotWithThreadMode<'a, D> where
D: RefUnwindSafe,
impl<'a, D> Unpin for SnapshotWithThreadMode<'a, D>
impl<'a, D> UnwindSafe for SnapshotWithThreadMode<'a, D> where
D: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more