Trait ibc_chain_registry::querier::QueryContext

source ·
pub trait QueryContext: QueryTypes {
    // Required methods
    fn query_error(chain_name: String) -> Self::QueryError;
    fn query<'async_trait>(
        url: Self::QueryInput,
    ) -> Pin<Box<dyn Future<Output = Result<Self::QueryOutput, Self::QueryError>> + Send + 'async_trait>>
       where Self: 'async_trait;

    // Provided method
    fn query_healthy<'async_trait>(
        chain_name: String,
        urls: Vec<Self::QueryInput>,
    ) -> Pin<Box<dyn Future<Output = Result<Self::QueryOutput, Self::QueryError>> + Send + 'async_trait>>
       where Self: Send + 'async_trait { ... }
}
Expand description

QueryContext represents the basic expectations for a query

Required Methods§

source

fn query_error(chain_name: String) -> Self::QueryError

Return an error specific to the query which is returned when query_healthy fails

§Arguments
  • chain_name - A string slice that holds the name of a chain
source

fn query<'async_trait>( url: Self::QueryInput, ) -> Pin<Box<dyn Future<Output = Result<Self::QueryOutput, Self::QueryError>> + Send + 'async_trait>>
where Self: 'async_trait,

Query an endpoint and return the result

§Arguments
  • url - A QueryInput object that holds the data needed to query a node

Provided Methods§

source

fn query_healthy<'async_trait>( chain_name: String, urls: Vec<Self::QueryInput>, ) -> Pin<Box<dyn Future<Output = Result<Self::QueryOutput, Self::QueryError>> + Send + 'async_trait>>
where Self: Send + 'async_trait,

Query every endpoint from a list of urls and return the output of the first one to answer.

§Arguments
  • chain_name - A string that holds the name of a chain
  • urls - A vector of urls to query

Object Safety§

This trait is not object safe.

Implementors§