Trait sp_messenger::endpoint::EndpointHandler

source ·
pub trait EndpointHandler<MessageId> {
    // Required methods
    fn message(
        &self,
        src_chain_id: ChainId,
        message_id: MessageId,
        req: EndpointRequest,
    ) -> EndpointResponse;
    fn message_weight(&self) -> Weight;
    fn message_response(
        &self,
        dst_chain_id: ChainId,
        message_id: MessageId,
        req: EndpointRequest,
        resp: EndpointResponse,
    ) -> DispatchResult;
    fn message_response_weight(&self) -> Weight;
}
Expand description

Handler to

  • handle message request from other chains.
  • handle requested message responses from other chains.

Required Methods§

source

fn message( &self, src_chain_id: ChainId, message_id: MessageId, req: EndpointRequest, ) -> EndpointResponse

Triggered by pallet-messenger when a new inbox message is received and bound for this handler.

source

fn message_weight(&self) -> Weight

Return the maximal possible consume weight of message

source

fn message_response( &self, dst_chain_id: ChainId, message_id: MessageId, req: EndpointRequest, resp: EndpointResponse, ) -> DispatchResult

Triggered by pallet-messenger when a response for a request is received from dst_chain_id.

source

fn message_response_weight(&self) -> Weight

Return the maximal possible consume weight of message_response

Implementors§