pub struct Mailbox<B, C, H, P>{ /* private fields */ }Expand description
A mailbox for sending messages to the Engine.
Implementations§
Source§impl<B, C, H, P> Mailbox<B, C, H, P>
impl<B, C, H, P> Mailbox<B, C, H, P>
Sourcepub const fn new(sender: Sender<Message<B, C, H, P>>) -> Self
pub const fn new(sender: Sender<Message<B, C, H, P>>) -> Self
Create a new Mailbox with the given sender.
Sourcepub async fn proposed(&self, round: Round, block: CodedBlock<B, C, H>)
pub async fn proposed(&self, round: Round, block: CodedBlock<B, C, H>)
Broadcast a proposed erasure coded block’s shards to the participants.
Sourcepub async fn discovered(&self, commitment: Commitment, leader: P, round: Round)
pub async fn discovered(&self, commitment: Commitment, leader: P, round: Round)
Inform the engine of an externally proposed Commitment.
Sourcepub async fn get(
&self,
commitment: Commitment,
) -> Option<Arc<CodedBlock<B, C, H>>>
pub async fn get( &self, commitment: Commitment, ) -> Option<Arc<CodedBlock<B, C, H>>>
Request a reconstructed block by its Commitment.
Sourcepub async fn get_by_digest(
&self,
digest: B::Digest,
) -> Option<Arc<CodedBlock<B, C, H>>>
pub async fn get_by_digest( &self, digest: B::Digest, ) -> Option<Arc<CodedBlock<B, C, H>>>
Request a reconstructed block by its digest.
Sourcepub async fn subscribe_assigned_shard_verified(
&self,
commitment: Commitment,
) -> Receiver<()>
pub async fn subscribe_assigned_shard_verified( &self, commitment: Commitment, ) -> Receiver<()>
Subscribe to assigned shard verification for a commitment.
For participants, this resolves once the leader-delivered shard for the local participant index has been verified. Reconstructing the full block from gossiped shards does not resolve this subscription: that block may still be used for later certification, but it is not enough to claim the participant received the shard it is expected to echo.
For proposers, this resolves immediately after the locally built block is cached because they trivially have all shards.
Sourcepub async fn subscribe(
&self,
commitment: Commitment,
) -> Receiver<Arc<CodedBlock<B, C, H>>>
pub async fn subscribe( &self, commitment: Commitment, ) -> Receiver<Arc<CodedBlock<B, C, H>>>
Subscribe to the reconstruction of a CodedBlock by its Commitment.
Sourcepub async fn subscribe_by_digest(
&self,
digest: B::Digest,
) -> Receiver<Arc<CodedBlock<B, C, H>>>
pub async fn subscribe_by_digest( &self, digest: B::Digest, ) -> Receiver<Arc<CodedBlock<B, C, H>>>
Subscribe to the reconstruction of a CodedBlock by its digest.
Sourcepub async fn prune(&self, through: Commitment)
pub async fn prune(&self, through: Commitment)
Request to prune all caches at and below the given commitment.
Trait Implementations§
Source§impl<B, C, H, P> Buffer<Coding<B, C, H, P>> for Mailbox<B, C, H, P>where
B: CertifiableBlock<Context = Context<Commitment, P>>,
C: CodingScheme,
H: Hasher,
P: PublicKey,
impl<B, C, H, P> Buffer<Coding<B, C, H, P>> for Mailbox<B, C, H, P>where
B: CertifiableBlock<Context = Context<Commitment, P>>,
C: CodingScheme,
H: Hasher,
P: PublicKey,
Source§type CachedBlock = Arc<CodedBlock<B, C, H>>
type CachedBlock = Arc<CodedBlock<B, C, H>>
Source§async fn find_by_digest(
&self,
digest: <CodedBlock<B, C, H> as Digestible>::Digest,
) -> Option<Self::CachedBlock>
async fn find_by_digest( &self, digest: <CodedBlock<B, C, H> as Digestible>::Digest, ) -> Option<Self::CachedBlock>
Source§async fn find_by_commitment(
&self,
commitment: Commitment,
) -> Option<Self::CachedBlock>
async fn find_by_commitment( &self, commitment: Commitment, ) -> Option<Self::CachedBlock>
Source§async fn subscribe_by_digest(
&self,
digest: <CodedBlock<B, C, H> as Digestible>::Digest,
) -> Receiver<Self::CachedBlock>
async fn subscribe_by_digest( &self, digest: <CodedBlock<B, C, H> as Digestible>::Digest, ) -> Receiver<Self::CachedBlock>
Source§async fn subscribe_by_commitment(
&self,
commitment: Commitment,
) -> Receiver<Self::CachedBlock>
async fn subscribe_by_commitment( &self, commitment: Commitment, ) -> Receiver<Self::CachedBlock>
Source§async fn finalized(&self, commitment: Commitment)
async fn finalized(&self, commitment: Commitment)
Source§async fn send(
&self,
round: Round,
block: CodedBlock<B, C, H>,
_recipients: Recipients<P>,
)
async fn send( &self, round: Round, block: CodedBlock<B, C, H>, _recipients: Recipients<P>, )
Auto Trait Implementations§
impl<B, C, H, P> Freeze for Mailbox<B, C, H, P>
impl<B, C, H, P> RefUnwindSafe for Mailbox<B, C, H, P>
impl<B, C, H, P> Send for Mailbox<B, C, H, P>
impl<B, C, H, P> Sync for Mailbox<B, C, H, P>
impl<B, C, H, P> Unpin for Mailbox<B, C, H, P>
impl<B, C, H, P> UnsafeUnpin for Mailbox<B, C, H, P>
impl<B, C, H, P> UnwindSafe for Mailbox<B, C, H, P>
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