Skip to main content

sync_with_others

Function sync_with_others 

Source
pub fn sync_with_others(
    library: &mut Library,
    network: &Network,
    timeout: Duration,
    now: &dyn Fn() -> u64,
    rng: &mut impl CryptoRng,
) -> Result<Vec<SyncedWith>, NodeError>
Expand description

Syncs once with each of the user’s other replicas that it finds on the network within timeout, one after the other. network need not take connections. What is received is checked against the time now gives when it arrives.

§Errors

Returns NodeError::NoOtherReplicas if the library has no other replica to sync with, and an error if the library cannot be read or written; a sync that fails is in its result.