pub trait IFederationApi: Debug + MaybeSend + MaybeSync {
    // Required methods
    fn all_peers(&self) -> &BTreeSet<PeerId>;
    fn with_module(&self, id: ModuleInstanceId) -> DynModuleApi;
    fn request_raw<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        peer_id: PeerId,
        method: &'life1 str,
        params: &'life2 [Value]
    ) -> Pin<Box<dyn Future<Output = Result<Value, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

An API (module or global) that can query a federation

Required Methods§

source

fn all_peers(&self) -> &BTreeSet<PeerId>

List of all federation peers for the purpose of iterating each peer in the federation.

The underlying implementation is responsible for knowing how many and PeerIds of each. The caller of this interface most probably have some idea as well, but passing this set across every API call to the federation would be inconvenient.

source

fn with_module(&self, id: ModuleInstanceId) -> DynModuleApi

source

fn request_raw<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, peer_id: PeerId, method: &'life1 str, params: &'life2 [Value] ) -> Pin<Box<dyn Future<Output = Result<Value, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Make request to a specific federation peer by peer_id

Implementors§

source§

impl<C: JsonRpcClient + Debug + 'static> IFederationApi for WsFederationApi<C>

Implementation of API calls over websockets

Can function as either the global or module API