Skip to content

Commit 2e4c8e0

Browse files
committed
feat(aggregator-discovery): introduce 'AggregatorDiscoverer' trait
1 parent 71bfe5e commit 2e4c8e0

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//! Interface definition for Mithril Protocol Configuration provider.
2+
3+
use mithril_common::StdResult;
4+
5+
use crate::model::{AggregatorEndpoint, MithrilNetwork};
6+
7+
/// An aggregator discoverer.
8+
#[cfg_attr(test, mockall::automock)]
9+
#[async_trait::async_trait]
10+
pub 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 is sorted, complete or up-to-date.
14+
async fn get_available_aggregators(
15+
&self,
16+
network: MithrilNetwork,
17+
) -> StdResult<Vec<AggregatorEndpoint>>;
18+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
#![warn(missing_docs)]
22
//! This crate provides mechanisms to discover aggregators in a Mithril network.
3+
4+
mod interface;
35
mod model;
6+
7+
pub use interface::AggregatorDiscoverer;
48
pub use model::{AggregatorEndpoint, MithrilNetwork};

0 commit comments

Comments
 (0)