use std::{collections::HashSet, fmt::Debug};
use async_trait::async_trait;
use pezsc_authority_discovery::Service as AuthorityDiscoveryService;
use pezkuwi_primitives::AuthorityDiscoveryId;
use pezsc_network::Multiaddr;
use pezsc_network_types::PeerId;
#[async_trait]
pub trait AuthorityDiscovery: Send + Debug + 'static {
async fn get_addresses_by_authority_id(
&mut self,
authority: AuthorityDiscoveryId,
) -> Option<HashSet<Multiaddr>>;
async fn get_authority_ids_by_peer_id(
&mut self,
peer_id: PeerId,
) -> Option<HashSet<AuthorityDiscoveryId>>;
}
#[async_trait]
impl AuthorityDiscovery for AuthorityDiscoveryService {
async fn get_addresses_by_authority_id(
&mut self,
authority: AuthorityDiscoveryId,
) -> Option<HashSet<Multiaddr>> {
AuthorityDiscoveryService::get_addresses_by_authority_id(self, authority).await
}
async fn get_authority_ids_by_peer_id(
&mut self,
peer_id: PeerId,
) -> Option<HashSet<AuthorityDiscoveryId>> {
AuthorityDiscoveryService::get_authority_ids_by_peer_id(self, peer_id).await
}
}