Struct phron_finality::sync::substrate::verification::cache::VerifierCache
source · pub struct VerifierCache<AP, FI, H>{
cached_data: HashMap<SessionId, CachedData>,
session_info: SessionBoundaryInfo,
finalization_info: FI,
authority_provider: AP,
cache_size: usize,
lower_bound: SessionId,
genesis_header: H,
}
Expand description
Cache storing SessionVerifier structs and Aura authorities for multiple sessions.
Keeps up to cache_size
verifiers of top sessions.
If the session is too new or ancient it will fail to return requested data.
Highest session verifier this cache returns is for the session after the current finalization session.
Lowest session verifier this cache returns is for top_returned_session
- cache_size
.
Fields§
§cached_data: HashMap<SessionId, CachedData>
§session_info: SessionBoundaryInfo
§finalization_info: FI
§cache_size: usize
§lower_bound: SessionId
Lowest currently available session.
genesis_header: H
Implementations§
source§impl<AP, FI, H> VerifierCache<AP, FI, H>
impl<AP, FI, H> VerifierCache<AP, FI, H>
pub fn new( session_info: SessionBoundaryInfo, finalization_info: FI, authority_provider: AP, cache_size: usize, genesis_header: H ) -> Self
pub fn genesis_header(&self) -> &H
source§impl<AP, FI, H> VerifierCache<AP, FI, H>
impl<AP, FI, H> VerifierCache<AP, FI, H>
fn try_prune(&mut self, session_id: SessionId)
fn get_data(&mut self, number: BlockNumber) -> Result<&CachedData, CacheError>
Returns the list of Aura authorities for a given block number. Updates cache if necessary. Must be called using the number of the PARENT of the verified block. This method assumes that the queued Aura authorities will indeed become Aura authorities in the next session.
sourcepub fn get(
&mut self,
number: BlockNumber
) -> Result<&SessionVerifier, CacheError>
pub fn get( &mut self, number: BlockNumber ) -> Result<&SessionVerifier, CacheError>
Returns session verifier for block number if available. Updates cache if necessary. Must be called using the number of the verified block.
Trait Implementations§
source§impl<AP, FS> Verifier<Justification> for VerifierCache<AP, FS, Header>where
AP: AuthorityProvider,
FS: FinalizationInfo,
impl<AP, FS> Verifier<Justification> for VerifierCache<AP, FS, Header>where
AP: AuthorityProvider,
FS: FinalizationInfo,
type Error = VerificationError
source§fn verify_justification(
&mut self,
justification: Justification
) -> Result<Justification, Self::Error>
fn verify_justification( &mut self, justification: Justification ) -> Result<Justification, Self::Error>
fn verify_header(&mut self, header: Header) -> Result<Header, Self::Error>
Auto Trait Implementations§
impl<AP, FI, H> RefUnwindSafe for VerifierCache<AP, FI, H>
impl<AP, FI, H> Send for VerifierCache<AP, FI, H>
impl<AP, FI, H> Sync for VerifierCache<AP, FI, H>
impl<AP, FI, H> Unpin for VerifierCache<AP, FI, H>
impl<AP, FI, H> UnwindSafe for VerifierCache<AP, FI, H>
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
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
§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
§fn checked_from<T>(t: T) -> Option<Self>where
Self: TryFrom<T>,
fn checked_from<T>(t: T) -> Option<Self>where
Self: TryFrom<T>,
§fn checked_into<T>(self) -> Option<T>where
Self: TryInto<T>,
fn checked_into<T>(self) -> Option<T>where
Self: TryInto<T>,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<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>
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>
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§impl<T> IsType<T> for T
impl<T> IsType<T> for T
§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T
. Read more§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from
.§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.