mithril_aggregator_discovery/interface.rs
1//! Interface definition for Mithril aggregator discoverer.
2
3use mithril_common::{StdResult, entities::MithrilNetwork};
4
5use crate::model::AggregatorEndpoint;
6
7/// An aggregator discoverer.
8#[cfg_attr(test, mockall::automock)]
9#[async_trait::async_trait]
10pub trait AggregatorDiscoverer: Sync + Send {
11 /// Get an iterator over a list of available aggregators in a Mithril network.
12 ///
13 /// Note: there is no guarantee that the returned aggregators are sorted, complete or up-to-date.
14 async fn get_available_aggregators(
15 &self,
16 network: MithrilNetwork,
17 ) -> StdResult<Box<dyn Iterator<Item = AggregatorEndpoint>>>;
18}