SharedStore

Struct SharedStore 

Source
pub struct SharedStore<S>(/* private fields */);
Expand description

Wraps a store to make it shareable by cloning

Implementations§

Source§

impl<S> SharedStore<S>

Source

pub fn new(store: S) -> Self

Source

pub fn share(&self) -> Self

Trait Implementations§

Source§

impl<S: Clone> Clone for SharedStore<S>

Source§

fn clone(&self) -> SharedStore<S>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<S: Debug> Debug for SharedStore<S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<S> Default for SharedStore<S>
where S: Default + Store,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<S> Deref for SharedStore<S>

Source§

type Target = Arc<RwLock<S>>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<S> DerefMut for SharedStore<S>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<S> ProvableStore for SharedStore<S>
where S: ProvableStore,

Source§

fn root_hash(&self) -> Vec<u8>

Return a vector commitment
Source§

fn get_proof(&self, height: Height, key: &Path) -> Option<CommitmentProof>

Return proof of existence for key
Source§

impl<S> Store for SharedStore<S>
where S: Store,

Source§

type Error = <S as Store>::Error

Error type - expected to envelope all possible errors in store
Source§

fn set( &mut self, path: Path, value: Vec<u8>, ) -> Result<Option<Vec<u8>>, Self::Error>

Set value for path
Source§

fn get(&self, height: Height, path: &Path) -> Option<Vec<u8>>

Get associated value for path at specified height
Source§

fn delete(&mut self, path: &Path)

Delete specified path
Source§

fn commit(&mut self) -> Result<Vec<u8>, Self::Error>

Commit Pending block to canonical chain and create new Pending
Source§

fn apply(&mut self) -> Result<(), Self::Error>

Apply accumulated changes to Pending
Source§

fn reset(&mut self)

Reset accumulated changes
Source§

fn current_height(&self) -> RawHeight

Return the current height of the chain
Source§

fn get_keys(&self, key_prefix: &Path) -> Vec<Path>

Return all keys that start with specified prefix
Source§

fn prune(&mut self, height: RawHeight) -> Result<RawHeight, Self::Error>

Prune historic blocks upto specified height

Auto Trait Implementations§

§

impl<S> Freeze for SharedStore<S>

§

impl<S> RefUnwindSafe for SharedStore<S>

§

impl<S> Send for SharedStore<S>
where S: Send + Sync,

§

impl<S> Sync for SharedStore<S>
where S: Send + Sync,

§

impl<S> Unpin for SharedStore<S>

§

impl<S> UnwindSafe for SharedStore<S>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<A> Async for A
where A: Send + Sync + 'static,