reth::builder::payload_builder

Trait PayloadBuilder

pub trait PayloadBuilder:
    Debug
    + Send
    + Sync
    + Unpin {
    type PayloadType: PayloadTypes;
    type Error: Into<PayloadBuilderError>;

    // Required methods
    fn send_new_payload(
        &self,
        attr: <Self::PayloadType as PayloadTypes>::PayloadBuilderAttributes,
    ) -> Receiver<Result<PayloadId, Self::Error>> ;
    fn best_payload<'life0, 'async_trait>(
        &'life0 self,
        id: PayloadId,
    ) -> Pin<Box<dyn Future<Output = Option<Result<<Self::PayloadType as PayloadTypes>::BuiltPayload, Self::Error>>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn resolve_kind<'life0, 'async_trait>(
        &'life0 self,
        id: PayloadId,
        kind: PayloadKind,
    ) -> Pin<Box<dyn Future<Output = Option<Result<<Self::PayloadType as PayloadTypes>::BuiltPayload, Self::Error>>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn subscribe<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<PayloadEvents<Self::PayloadType>, Self::Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn payload_attributes<'life0, 'async_trait>(
        &'life0 self,
        id: PayloadId,
    ) -> Pin<Box<dyn Future<Output = Option<Result<<Self::PayloadType as PayloadTypes>::PayloadBuilderAttributes, Self::Error>>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;

    // Provided method
    fn resolve<'life0, 'async_trait>(
        &'life0 self,
        id: PayloadId,
    ) -> Pin<Box<dyn Future<Output = Option<Result<<Self::PayloadType as PayloadTypes>::BuiltPayload, Self::Error>>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait { ... }
}
Expand description

A type that can request, subscribe to and resolve payloads.

Required Associated Types§

type PayloadType: PayloadTypes

The Payload type for the builder.

type Error: Into<PayloadBuilderError>

The error type returned by the builder.

Required Methods§

fn send_new_payload( &self, attr: <Self::PayloadType as PayloadTypes>::PayloadBuilderAttributes, ) -> Receiver<Result<PayloadId, Self::Error>>

Sends a message to the service to start building a new payload for the given payload.

Returns a receiver that will receive the payload id.

fn best_payload<'life0, 'async_trait>( &'life0 self, id: PayloadId, ) -> Pin<Box<dyn Future<Output = Option<Result<<Self::PayloadType as PayloadTypes>::BuiltPayload, Self::Error>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Returns the best payload for the given identifier.

fn resolve_kind<'life0, 'async_trait>( &'life0 self, id: PayloadId, kind: PayloadKind, ) -> Pin<Box<dyn Future<Output = Option<Result<<Self::PayloadType as PayloadTypes>::BuiltPayload, Self::Error>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Resolves the payload job and returns the best payload that has been built so far.

fn subscribe<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<PayloadEvents<Self::PayloadType>, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Sends a message to the service to subscribe to payload events. Returns a receiver that will receive them.

fn payload_attributes<'life0, 'async_trait>( &'life0 self, id: PayloadId, ) -> Pin<Box<dyn Future<Output = Option<Result<<Self::PayloadType as PayloadTypes>::PayloadBuilderAttributes, Self::Error>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Returns the payload attributes associated with the given identifier.

Provided Methods§

fn resolve<'life0, 'async_trait>( &'life0 self, id: PayloadId, ) -> Pin<Box<dyn Future<Output = Option<Result<<Self::PayloadType as PayloadTypes>::BuiltPayload, Self::Error>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Resolves the payload job as fast and possible and returns the best payload that has been built so far.

Implementors§