pub struct Mailbox<S: Scheme, V: Variant> { /* private fields */ }Expand description
A mailbox for sending messages to the marshal Actor.
Implementations§
Source§impl<S: Scheme, V: Variant> Mailbox<S, V>
impl<S: Scheme, V: Variant> Mailbox<S, V>
Sourcepub async fn get_info(
&self,
identifier: impl Into<Identifier<<V::Block as Digestible>::Digest>>,
) -> Option<(Height, <V::Block as Digestible>::Digest)>
pub async fn get_info( &self, identifier: impl Into<Identifier<<V::Block as Digestible>::Digest>>, ) -> Option<(Height, <V::Block as Digestible>::Digest)>
A request to retrieve the information about the highest finalized block.
Sourcepub async fn get_block(
&self,
identifier: impl Into<Identifier<<V::Block as Digestible>::Digest>>,
) -> Option<V::Block>
pub async fn get_block( &self, identifier: impl Into<Identifier<<V::Block as Digestible>::Digest>>, ) -> Option<V::Block>
A best-effort attempt to retrieve a given block from local storage. It is not an indication to go fetch the block from the network.
Sourcepub async fn get_finalization(
&self,
height: Height,
) -> Option<Finalization<S, V::Commitment>>
pub async fn get_finalization( &self, height: Height, ) -> Option<Finalization<S, V::Commitment>>
A best-effort attempt to retrieve a given Finalization from local storage. It is not an indication to go fetch the Finalization from the network.
Sourcepub async fn hint_finalized(
&self,
height: Height,
targets: NonEmptyVec<S::PublicKey>,
)
pub async fn hint_finalized( &self, height: Height, targets: NonEmptyVec<S::PublicKey>, )
Hints that a finalized block may be available at the given height.
This method will request the finalization from the network via the resolver if it is not available locally.
Targets are required because this is typically called when a peer claims to be ahead. By targeting only those peers, we limit who we ask. If a target returns invalid data, they will be blocked by the resolver. If targets don’t respond or return “no data”, they effectively rate-limit themselves.
Calling this multiple times for the same height with different targets will add to the target set if there is an ongoing fetch, allowing more peers to be tried.
This is fire-and-forget: the finalization will be stored in marshal and delivered via the normal finalization flow when available.
The height must be covered by both the epocher and the provider. If the epocher cannot map the height to an epoch, or the provider cannot supply a scheme for that epoch, the hint is silently dropped.
Sourcepub async fn subscribe_by_digest(
&self,
round: Option<Round>,
digest: <V::Block as Digestible>::Digest,
) -> Receiver<V::Block>
pub async fn subscribe_by_digest( &self, round: Option<Round>, digest: <V::Block as Digestible>::Digest, ) -> Receiver<V::Block>
Subscribe to a block by its digest.
If the block is found available locally, the block will be returned immediately.
If the block is not available locally, the request will be registered and the caller will be notified when the block is available. If the block is not finalized, it’s possible that it may never become available.
The oneshot receiver should be dropped to cancel the subscription.
Sourcepub async fn subscribe_by_commitment(
&self,
round: Option<Round>,
commitment: V::Commitment,
) -> Receiver<V::Block>
pub async fn subscribe_by_commitment( &self, round: Option<Round>, commitment: V::Commitment, ) -> Receiver<V::Block>
Subscribe to a block by its commitment.
If the block is found available locally, the block will be returned immediately.
If the block is not available locally, the request will be registered and the caller will be notified when the block is available. If the block is not finalized, it’s possible that it may never become available.
The oneshot receiver should be dropped to cancel the subscription.
Sourcepub async fn ancestry(
&self,
__arg1: (Option<Round>, <V::Block as Digestible>::Digest),
) -> Option<AncestorStream<Self, V::ApplicationBlock>>
pub async fn ancestry( &self, __arg1: (Option<Round>, <V::Block as Digestible>::Digest), ) -> Option<AncestorStream<Self, V::ApplicationBlock>>
Returns an AncestorStream over the ancestry of a given block, leading up to genesis.
If the starting block is not found, None is returned.
Sourcepub async fn proposed(&self, round: Round, block: V::Block)
pub async fn proposed(&self, round: Round, block: V::Block)
Requests that a proposed block is sent to peers.
Sourcepub async fn verified(&self, round: Round, block: V::Block)
pub async fn verified(&self, round: Round, block: V::Block)
Notifies the actor that a block has been verified.
Sourcepub async fn set_floor(&self, height: Height)
pub async fn set_floor(&self, height: Height)
Sets the sync starting point (advances if higher than current).
Marshal will sync and deliver blocks starting at floor + 1. Data below
the floor is pruned.
To prune data without affecting the sync starting point (say at some trailing depth from tip), use Self::prune instead.
The default floor is 0.
Sourcepub async fn prune(&self, height: Height)
pub async fn prune(&self, height: Height)
Prunes finalized blocks and certificates below the given height.
Unlike Self::set_floor, this does not affect the sync starting point. The height must be at or below the current floor (last processed height), otherwise the prune request is ignored.
A prune request for a height above marshal’s current floor is dropped.
Trait Implementations§
Source§impl<S: Scheme, V: Variant> BlockProvider for Mailbox<S, V>
impl<S: Scheme, V: Variant> BlockProvider for Mailbox<S, V>
Source§type Block = <V as Variant>::ApplicationBlock
type Block = <V as Variant>::ApplicationBlock
Source§async fn fetch_block(
self,
digest: <V::Block as Digestible>::Digest,
) -> Option<Self::Block>
async fn fetch_block( self, digest: <V::Block as Digestible>::Digest, ) -> Option<Self::Block>
Auto Trait Implementations§
impl<S, V> Freeze for Mailbox<S, V>
impl<S, V> RefUnwindSafe for Mailbox<S, V>
impl<S, V> Send for Mailbox<S, V>
impl<S, V> Sync for Mailbox<S, V>
impl<S, V> Unpin for Mailbox<S, V>
impl<S, V> UnsafeUnpin for Mailbox<S, V>
impl<S, V> UnwindSafe for Mailbox<S, V>
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
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<B> IntoBlock<B> for B
impl<B> IntoBlock<B> for B
Source§fn into_block(self) -> B
fn into_block(self) -> B
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