Skip to content

Commit 780dfff

Browse files
dyc3cjrkoa
authored andcommitted
balancer: rename MonolithDiscovery to MonolithDiscoverer (dyc3#1172)
1 parent 23e8b5f commit 780dfff

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

crates/ott-balancer-bin/src/discovery.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl<'de> Deserialize<'de> for HostOrIp {
7171
}
7272

7373
#[async_trait]
74-
pub trait MonolithDiscovery {
74+
pub trait MonolithDiscoverer {
7575
/// In polling mode, this function should immediately return the current list of monoliths. In continuous mode, this function should wait until the list of monoliths changes, then return the new list.
7676
async fn discover(&mut self) -> anyhow::Result<Vec<MonolithConnectionConfig>>;
7777
fn mode(&self) -> DiscoveryMode;
@@ -83,15 +83,15 @@ pub enum DiscoveryMode {
8383
}
8484

8585
pub struct DiscoveryTask {
86-
discovery: Box<dyn MonolithDiscovery + Send + Sync>,
86+
discovery: Box<dyn MonolithDiscoverer + Send + Sync>,
8787

8888
monoliths: HashSet<MonolithConnectionConfig>,
8989
discovery_tx: tokio::sync::mpsc::Sender<MonolithDiscoveryMsg>,
9090
}
9191

9292
impl DiscoveryTask {
9393
pub fn new(
94-
discovery: impl MonolithDiscovery + Send + Sync + 'static,
94+
discovery: impl MonolithDiscoverer + Send + Sync + 'static,
9595
discovery_tx: tokio::sync::mpsc::Sender<MonolithDiscoveryMsg>,
9696
) -> Self {
9797
Self {
@@ -148,7 +148,7 @@ fn build_discovery_msg(
148148
}
149149

150150
pub fn start_discovery_task(
151-
discovery: impl MonolithDiscovery + Send + Sync + 'static,
151+
discovery: impl MonolithDiscoverer + Send + Sync + 'static,
152152
discovery_tx: tokio::sync::mpsc::Sender<MonolithDiscoveryMsg>,
153153
) -> JoinHandle<()> {
154154
tokio::task::Builder::new()

crates/ott-balancer-bin/src/discovery/fly.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ impl FlyMonolithDiscoverer {
2828
}
2929

3030
#[async_trait]
31-
impl MonolithDiscovery for FlyMonolithDiscoverer {
31+
impl MonolithDiscoverer for FlyMonolithDiscoverer {
3232
async fn discover(&mut self) -> anyhow::Result<Vec<MonolithConnectionConfig>> {
3333
let resolver =
3434
TokioAsyncResolver::tokio_from_system_conf().expect("failed to create resolver");

crates/ott-balancer-bin/src/discovery/harness.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ impl HarnessMonolithDiscoverer {
8282
}
8383

8484
#[async_trait]
85-
impl MonolithDiscovery for HarnessMonolithDiscoverer {
85+
impl MonolithDiscoverer for HarnessMonolithDiscoverer {
8686
async fn discover(&mut self) -> anyhow::Result<Vec<MonolithConnectionConfig>> {
8787
self.updated_rx.recv().await;
8888
Ok(self

crates/ott-balancer-bin/src/discovery/manual.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl ManualMonolithDiscoverer {
2323
}
2424

2525
#[async_trait]
26-
impl MonolithDiscovery for ManualMonolithDiscoverer {
26+
impl MonolithDiscoverer for ManualMonolithDiscoverer {
2727
async fn discover(&mut self) -> anyhow::Result<Vec<MonolithConnectionConfig>> {
2828
#[allow(clippy::while_immutable_condition)]
2929
while self.discovered {

0 commit comments

Comments
 (0)