Skip to main content

pull_from_shared

Function pull_from_shared 

Source
pub fn pull_from_shared(
    state: &Mutex<SyncState>,
    node: &Node<Vec<u8>, Vec<u8>>,
    peer: PeerId,
    addrs: &[Multiaddr],
    typ_name: &str,
) -> PullOutcome
Expand description

Pull for a state shared with this node’s SyncHandler, without holding its lock across the network: snapshot, pull into the snapshot, then SyncState::merge_back (also after an error, so pages already applied are kept).

Holding the lock for the whole pull (as pull_from(&mut state.lock()..) does) stops this node answering meanwhile, and two nodes pulling from each other at once then wait on each other until the request times out.