DBVersionedStateStore

Struct DBVersionedStateStore 

pub struct DBVersionedStateStore<V: VersionIdentifier, T: KVStore>(pub RwLock<DBVersionedStateStoreInner<V, T>>);
Expand description

RocksDB backed persistent VersionedStateStore.

Tuple Fields§

§0: RwLock<DBVersionedStateStoreInner<V, T>>

Implementations§

§

impl<V: VersionIdentifier, T: KVStore> DBVersionedStateStore<V, T>

pub fn new( store: T, branch_factor: usize, ) -> Result<Self, VersionedStateStoreError>

pub fn calc_node_hash( current_node: &MerkleNode, inner: &DBVersionedStateStoreInner<V, T>, ) -> Result<Hash, VersionedStateStoreError>

pub fn merkle_hash( &self, version_id: &V, ) -> Result<Hash, VersionedStateStoreError>

pub fn is_empty_root( &self, version_id: &V, ) -> Result<bool, VersionedStateStoreError>

Trait Implementations§

§

impl<V: VersionIdentifier, T: KVStore> VersionedStateStore<V> for DBVersionedStateStore<V, T>

§

fn atomic_write<'a>( &'a self, base: Option<&V>, version_id: &V, changes: Box<dyn Iterator<Item = (Key, Option<Value>)> + 'a>, ) -> Result<(), VersionedStateStoreError>

Atomically apply a list of changes described by the iterator to the state of the base version, saved in the new version. Also set the latest version to version. For each iterated item, a None value will remove the value if it exists.
§

impl<V: VersionIdentifier, T: KVStore> VersionedStateStoreR<V> for DBVersionedStateStore<V, T>

§

fn debug_iter<'a>( &'a self, _: &V, ) -> Box<dyn Iterator<Item = (Key, Value)> + 'a>

§

fn get(&self, version_id: &V, key: Key) -> Option<Value>

Retrieve the value for a particular version given a key. Returns None if not exists.
§

fn get_all(&self, version_id: &V, key_prefix: Key) -> HashMap<Key, Value>

Retrieve all the values for a given key prefix in a given version. HashMap is empty if no such version or key prefix not exists.
§

fn contains(&self, version_id: &V, key: Key) -> bool

§

fn latest_version_id(&self) -> Option<V>

Obtain the latest version identifier that has been successfully written.

Auto Trait Implementations§

§

impl<V, T> !Freeze for DBVersionedStateStore<V, T>

§

impl<V, T> !RefUnwindSafe for DBVersionedStateStore<V, T>

§

impl<V, T> Send for DBVersionedStateStore<V, T>

§

impl<V, T> Sync for DBVersionedStateStore<V, T>

§

impl<V, T> Unpin for DBVersionedStateStore<V, T>
where T: Unpin, V: Unpin,

§

impl<V, T> UnwindSafe for DBVersionedStateStore<V, T>
where T: UnwindSafe, V: UnwindSafe,

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> MaybeSend for T
where T: Send,