pub struct Store<T> { /* private fields */ }Expand description
Implementation of ChainStore using pure_stage::Effects.
Implementations§
Trait Implementations§
Source§impl<T: SendData + Sync> ChainStore<BlockHeader> for Store<T>
impl<T: SendData + Sync> ChainStore<BlockHeader> for Store<T>
fn set_anchor_hash(&self, hash: &HeaderHash) -> Result<(), StoreError>
fn set_best_chain_hash(&self, hash: &HeaderHash) -> Result<(), StoreError>
fn store_header(&self, header: &BlockHeader) -> Result<(), StoreError>
fn store_block( &self, hash: &HeaderHash, block: &RawBlock, ) -> Result<(), StoreError>
fn put_nonces( &self, header: &HeaderHash, nonces: &Nonces, ) -> Result<(), StoreError>
Source§fn roll_forward_chain(&self, point: &Point) -> Result<(), StoreError>
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>
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> ReadOnlyChainStore<BlockHeader> for Store<T>
impl<T> ReadOnlyChainStore<BlockHeader> for Store<T>
Source§fn load_header(&self, hash: &HeaderHash) -> Option<BlockHeader>
fn load_header(&self, hash: &HeaderHash) -> Option<BlockHeader>
Try to load a header by its hash.
fn get_children(&self, hash: &HeaderHash) -> Vec<HeaderHash> ⓘ
fn get_anchor_hash(&self) -> HeaderHash
fn get_best_chain_hash(&self) -> HeaderHash
fn load_block(&self, hash: &HeaderHash) -> Result<Option<RawBlock>, StoreError>
fn get_nonces(&self, hash: &HeaderHash) -> Option<Nonces>
fn has_header(&self, hash: &HeaderHash) -> bool
Source§fn load_from_best_chain(&self, point: &Point) -> Option<HeaderHash>
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>
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>
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}>>
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,
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,
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> 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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