Skip to main content

Store

Struct Store 

Source
pub struct Store<T> { /* private fields */ }
Expand description

Implementation of ChainStore using pure_stage::Effects.

Implementations§

Source§

impl<T> Store<T>

Source

pub fn new(effects: Effects<T>) -> Store<T>

Source

pub fn external_sync<E: ExternalEffectSync + Serialize + 'static>( &self, effect: E, ) -> E::Response

This function runs an external effect synchronously.

Trait Implementations§

Source§

impl<T: SendData + Sync> ChainStore<BlockHeader> for Store<T>

Source§

fn set_anchor_hash(&self, hash: &HeaderHash) -> Result<(), StoreError>

Source§

fn set_best_chain_hash(&self, hash: &HeaderHash) -> Result<(), StoreError>

Source§

fn store_header(&self, header: &BlockHeader) -> Result<(), StoreError>

Source§

fn store_block( &self, hash: &HeaderHash, block: &RawBlock, ) -> Result<(), StoreError>

Source§

fn put_nonces( &self, header: &HeaderHash, nonces: &Nonces, ) -> Result<(), StoreError>

Source§

fn roll_forward_chain(&self, point: &Point) -> Result<(), StoreError>

Roll forward the best chain to the given point.
Source§

fn rollback_chain(&self, point: &Point) -> Result<usize, StoreError>

Rollback the best chain tip at the given point. The point must exist on the best chain, and all points on chain after that point will be deleted. Returns the number of headers that were rolled back.
Source§

impl<T> Clone for Store<T>

Source§

fn clone(&self) -> Self

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<T> ReadOnlyChainStore<BlockHeader> for Store<T>

Source§

fn load_header(&self, hash: &HeaderHash) -> Option<BlockHeader>

Try to load a header by its hash.
Source§

fn get_children(&self, hash: &HeaderHash) -> Vec<HeaderHash>

Source§

fn get_anchor_hash(&self) -> HeaderHash

Source§

fn get_best_chain_hash(&self) -> HeaderHash

Source§

fn load_block(&self, hash: &HeaderHash) -> Result<Option<RawBlock>, StoreError>

Source§

fn get_nonces(&self, hash: &HeaderHash) -> Option<Nonces>

Source§

fn has_header(&self, hash: &HeaderHash) -> bool

Source§

fn load_from_best_chain(&self, point: &Point) -> Option<HeaderHash>

Load a HeaderHash from the best chain. Returns None if the point is not in the best chain.
Source§

fn next_best_chain(&self, point: &Point) -> Option<Point>

Return the next Point on the best chain following given Point, if it exists.
Source§

fn load_tip( &self, hash: &Hash<amaru_kernel::::cardano::hash::HeaderHash::{constant#0}>, ) -> Option<Tip>

Retrieve the tip of a block header given its hash.
Source§

fn retrieve_best_chain( &self, ) -> Vec<Hash<amaru_kernel::::cardano::hash::HeaderHash::{constant#0}>>

Return the hashes of the best chain fragment, starting from the anchor.
Source§

fn ancestors<'a>(&'a self, start: H) -> Box<dyn Iterator<Item = H> + 'a>
where H: 'a,

Return the ancestors of the header, including the header itself. Stop if the followed chain reaches past the anchor.
Source§

fn ancestors_hashes<'a>( &'a self, hash: &Hash<amaru_kernel::::cardano::hash::HeaderHash::{constant#0}>, ) -> Box<dyn Iterator<Item = Hash<amaru_kernel::::cardano::hash::HeaderHash::{constant#0}>> + 'a>
where H: 'a,

Return the hashes of the ancestors of the header, including the header hash itself.

Auto Trait Implementations§

§

impl<T> Freeze for Store<T>

§

impl<T> !RefUnwindSafe for Store<T>

§

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

§

impl<T> Sync for Store<T>
where T: Sync,

§

impl<T> Unpin for Store<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Store<T>

§

impl<T> !UnwindSafe for Store<T>

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> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
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<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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