pub trait QueryHandler {
    type QueryId: From<u64> + FullCodec + MaxEncodedLen + TypeInfo + Clone + Eq + PartialEq + Debug + Copy;
    type BlockNumber: Zero + Encode;
    type Error;
    type UniversalLocation: Get<Junctions>;

    // Required methods
    fn new_query(
        responder: impl Into<Location>,
        timeout: Self::BlockNumber,
        match_querier: impl Into<Location>
    ) -> u64;
    fn report_outcome(
        message: &mut Xcm<()>,
        responder: impl Into<Location>,
        timeout: Self::BlockNumber
    ) -> Result<Self::QueryId, Self::Error>;
    fn take_response(
        id: Self::QueryId
    ) -> QueryResponseStatus<Self::BlockNumber>;
}
Expand description

Provides methods to expect responses from XCMs and query their status.

Required Associated Types§

Required Methods§

source

fn new_query( responder: impl Into<Location>, timeout: Self::BlockNumber, match_querier: impl Into<Location> ) -> u64

Attempt to create a new query ID and register it as a query that is yet to respond.

source

fn report_outcome( message: &mut Xcm<()>, responder: impl Into<Location>, timeout: Self::BlockNumber ) -> Result<Self::QueryId, Self::Error>

Consume message and return another which is equivalent to it except that it reports back the outcome.

  • message: The message whose outcome should be reported.
  • responder: The origin from which a response should be expected.
  • timeout: The block number after which it is permissible to return NotFound from take_response.

report_outcome may return an error if the responder is not invertible.

It is assumed that the querier of the response will be Here. The response can be queried with take_response.

source

fn take_response(id: Self::QueryId) -> QueryResponseStatus<Self::BlockNumber>

Attempt to remove and return the response of query with ID query_id.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl QueryHandler for ()

§

type BlockNumber = u64

§

type Error = ()

§

type QueryId = u64

§

type UniversalLocation = UniversalLocation

source§

fn take_response( _query_id: <() as QueryHandler>::QueryId ) -> QueryResponseStatus<<() as QueryHandler>::BlockNumber>

source§

fn new_query( _responder: impl Into<Location>, _timeout: <() as QueryHandler>::BlockNumber, _match_querier: impl Into<Location> ) -> <() as QueryHandler>::QueryId

source§

fn report_outcome( _message: &mut Xcm<()>, _responder: impl Into<Location>, _timeout: <() as QueryHandler>::BlockNumber ) -> Result<<() as QueryHandler>::QueryId, <() as QueryHandler>::Error>

Implementors§