reth_payload_builder_primitives

Trait PayloadBuilder

Source
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 Self: 'async_trait,
             'life0: '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 Self: 'async_trait,
             'life0: 'async_trait;
    fn subscribe<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<PayloadEvents<Self::PayloadType>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: '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 Self: 'async_trait,
             'life0: '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 Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

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

Required Associated Types§

Source

type PayloadType: PayloadTypes

The Payload type for the builder.

Source

type Error: Into<PayloadBuilderError>

The error type returned by the builder.

Required Methods§

Source

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.

Source

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 Self: 'async_trait, 'life0: 'async_trait,

Returns the best payload for the given identifier.

Source

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 Self: 'async_trait, 'life0: 'async_trait,

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

Source

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

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

Source

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 Self: 'async_trait, 'life0: 'async_trait,

Returns the payload attributes associated with the given identifier.

Provided Methods§

Source

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 Self: 'async_trait, 'life0: 'async_trait,

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

Implementors§