Skip to main content

lead

Function lead 

Source
pub async fn lead(
    control: &TcpListener,
    my_exchange_addr: &str,
    n_workers: usize,
    fingerprint: &str,
) -> Result<(Members, LeaderCtl)>
Expand description

The leader side of the rendezvous: wait for n_workers - 1 registrations on control, then broadcast the sorted member set + fingerprint to every worker. Returns the leader’s own Members (its me is my_exchange_addr’s index in the sorted set). The leader is worker 0 only if its address sorts first — placement depends on the addresses, not on who leads.