pub trait IRawFederationApi:
Debug
+ MaybeSend
+ MaybeSync {
// Required methods
fn all_peers(&self) -> &BTreeSet<PeerId>;
fn self_peer(&self) -> Option<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, JsonRpcClientError>> + 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§
Sourcefn all_peers(&self) -> &BTreeSet<PeerId>
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 PeerId
s 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.
Sourcefn self_peer(&self) -> Option<PeerId>
fn self_peer(&self) -> Option<PeerId>
PeerId of the Guardian node, if set
This is for using Client in a “Admin” mode, making authenticated
calls to own fedimintd
instance.
fn with_module(&self, id: ModuleInstanceId) -> DynModuleApi
Sourcefn 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, JsonRpcClientError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
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, JsonRpcClientError>> + 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§
impl<C: JsonRpcClient + Debug + 'static> IRawFederationApi for WsFederationApi<C>
Implementation of API calls over WebSockets
Can function as either the global or module API