Skip to content

Commit

Permalink
feat(workers/base): announce to several peers
Browse files Browse the repository at this point in the history
  • Loading branch information
PhotonQuantum committed Jul 26, 2022
1 parent b25c36c commit d9e9e87
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions workers/base/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ use crate::{Certificates, ID};

/// Configuration for worker nodes.
pub struct NodeConfig<A> {
// TODO this can be a list.
/// A peer URL to announce to the rest of the cluster.
///
/// This is optional. If not set, the worker will be started at idle state.
pub announce: Option<Uri>,
pub announce: Vec<Uri>,
/// Socket address to bind to for gossip protocol.
pub bind: A,
/// URI of this node to announce to the rest of the cluster.
Expand Down
4 changes: 2 additions & 2 deletions workers/base/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ pub async fn start_worker<A: ToSocketAddrs + Send>(
// Start the Foca runtime.
let kind = config.ident.kind().to_string();
let foca = start_foca(config.ident, stream, sink, None);
if let Some(announce) = config.announce {
foca.announce(ID::new(announce, kind));
for announce_peer in config.announce {
foca.announce(ID::new(announce_peer, kind.clone()));
}

// Prepare change stream.
Expand Down

0 comments on commit d9e9e87

Please sign in to comment.