Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
client/authority-discovery/src/service: Improve docs (#7059)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxinden authored Sep 9, 2020
1 parent 352bae2 commit 6feab7a
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions client/authority-discovery/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,18 @@ impl Service {
}
}

/// Get the addresses for the given [`AuthorityId`] from the local address cache.
/// Get the addresses for the given [`AuthorityId`] from the local address
/// cache.
///
/// Returns `None` if no entry was present or connection to the [`crate::Worker`] failed.
/// Returns `None` if no entry was present or connection to the
/// [`crate::Worker`] failed.
///
/// [`Multiaddr`]s returned always include a [`libp2p::core::multiaddr:Protocol::P2p`]
/// component.
/// [`Multiaddr`]s returned always include a [`PeerId`] via a
/// [`libp2p::core::multiaddr:Protocol::P2p`] component. [`Multiaddr`]s
/// might differ in their [`PeerId`], e.g. when each [`Multiaddr`]
/// represents a different sentry node. This might change once support for
/// sentry nodes is removed (see
/// https://github.com/paritytech/substrate/issues/6845).
pub async fn get_addresses_by_authority_id(&mut self, authority: AuthorityId) -> Option<Vec<Multiaddr>> {
let (tx, rx) = oneshot::channel();

Expand All @@ -54,9 +60,11 @@ impl Service {
rx.await.ok().flatten()
}

/// Get the [`AuthorityId`] for the given [`PeerId`] from the local address cache.
/// Get the [`AuthorityId`] for the given [`PeerId`] from the local address
/// cache.
///
/// Returns `None` if no entry was present or connection to the [`crate::Worker`] failed.
/// Returns `None` if no entry was present or connection to the
/// [`crate::Worker`] failed.
pub async fn get_authority_id_by_peer_id(&mut self, peer_id: PeerId) -> Option<AuthorityId> {
let (tx, rx) = oneshot::channel();

Expand Down

0 comments on commit 6feab7a

Please sign in to comment.