Skip to main content

SnapshotReadOptions

Struct SnapshotReadOptions 

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

Source

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

Returns the bytes associated with a key.

Source

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.

Source

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

Returns a pinned value associated with a key.

Source

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.

Source

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

Returns the values associated with the given keys.

Source

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

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

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> 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.