pub struct SnapshotReadOptions<'snapshot, 'db, D: DBAccess = DB> { /* private fields */ }Expand description
Reusable read state bound to a SnapshotWithThreadMode.
Creating this value configures one native ReadOptions with the snapshot.
Its get and multi-get methods reuse those options until the session is
dropped. Custom options can be supplied with
SnapshotWithThreadMode::read_options_opt.
The session cannot outlive its snapshot:
ⓘ
use rust_rocksdb::DB;
let db = DB::open_default("foo").unwrap();
let _read_options = {
let snapshot = db.snapshot();
snapshot.read_options()
};Implementations§
Source§impl<'db, D: DBAccess> SnapshotReadOptions<'_, 'db, D>
impl<'db, D: DBAccess> SnapshotReadOptions<'_, 'db, D>
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.
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 in a column family.
Sourcepub fn get_pinned<K: AsRef<[u8]>>(
&self,
key: K,
) -> Result<Option<DBPinnableSlice<'db>>, Error>
pub fn get_pinned<K: AsRef<[u8]>>( &self, key: K, ) -> Result<Option<DBPinnableSlice<'db>>, Error>
Returns a pinned value associated with a key.
Sourcepub fn get_pinned_cf<K: AsRef<[u8]>>(
&self,
cf: &impl AsColumnFamilyRef,
key: K,
) -> Result<Option<DBPinnableSlice<'db>>, Error>
pub fn get_pinned_cf<K: AsRef<[u8]>>( &self, cf: &impl AsColumnFamilyRef, key: K, ) -> Result<Option<DBPinnableSlice<'db>>, Error>
Returns a pinned value associated with a key in a column family.
Sourcepub 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>>
Returns the values associated with the given keys.
Auto Trait Implementations§
impl<'snapshot, 'db, D> Freeze for SnapshotReadOptions<'snapshot, 'db, D>
impl<'snapshot, 'db, D> RefUnwindSafe for SnapshotReadOptions<'snapshot, 'db, D>where
D: RefUnwindSafe,
impl<'snapshot, 'db, D> Send for SnapshotReadOptions<'snapshot, 'db, D>where
D: Sync,
impl<'snapshot, 'db, D> Sync for SnapshotReadOptions<'snapshot, 'db, D>where
D: Sync,
impl<'snapshot, 'db, D> Unpin for SnapshotReadOptions<'snapshot, 'db, D>
impl<'snapshot, 'db, D> UnsafeUnpin for SnapshotReadOptions<'snapshot, 'db, D>
impl<'snapshot, 'db, D> UnwindSafe for SnapshotReadOptions<'snapshot, 'db, D>where
D: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more