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 ApiRequestErased,
) -> Pin<Box<dyn Future<Output = ServerResult<Value>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn connection_status_stream(
&self,
) -> BoxStream<'static, BTreeMap<PeerId, bool>>;
fn wait_for_initialized_connections<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: '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 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.
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 ApiRequestErased,
) -> Pin<Box<dyn Future<Output = ServerResult<Value>> + 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 ApiRequestErased,
) -> Pin<Box<dyn Future<Output = ServerResult<Value>> + 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
Sourcefn connection_status_stream(&self) -> BoxStream<'static, BTreeMap<PeerId, bool>>
fn connection_status_stream(&self) -> BoxStream<'static, BTreeMap<PeerId, bool>>
Returns a stream of connection status for each peer
The stream emits a new value whenever the connection status changes.
Sourcefn wait_for_initialized_connections<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn wait_for_initialized_connections<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Wait for some connections being initialized
This is useful to avoid initializing networking by tasks that are not high priority.