pub fn sync(
        &mut self,
        cid: Cid,
        providers: Vec<PeerId>,
        missing: impl Iterator<Item = Cid>,
    ) -> QueryId {
        let timer = REQUEST_DURATION_SECONDS
            .with_label_values(&["sync"])
            .start_timer();
        let id = QueryId(self.id_counter);
        self.id_counter += 1;
        tracing::trace!("{} {} sync", id, id);
        let mut state = SyncState::default();
        for cid in missing {
            state
                .missing
                .insert(self.get(Some(id), cid, providers.iter().copied()));
        }
        if state.missing.is_empty() {
            state.children.insert(self.missing_blocks(id, cid));
        }
        state.providers = providers;
        let query = Query {
            hdr: Header {
                id,
                root: id,
                parent: None,
                cid,
                timer,
                label: "sync",
            },
            state: State::Sync(state),
        };
        self.queries.insert(id, query);
        id
    }
/// Starts a query to recursively retrieve a dag. The missing blocks are the first
/// blocks that need to be retrieved.
Starts a query to recursively retrieve a dag. The missing blocks are the first
blocks that need to be retrieved.
Starts a query to recursively retrieve a dag . The missing blocks are the first blocks that need to be retrieved .
pub fn sync(
        &mut self,
        cid: Cid,
        providers: Vec<PeerId>,
        missing: impl Iterator<Item = Cid>,
    ) -> QueryId {
        let timer = REQUEST_DURATION_SECONDS
            .with_label_values(&["sync"])
            .start_timer();
        let id = QueryId(self.id_counter);
        self.id_counter += 1;
        tracing::trace!("{} {} sync", id, id);
        let mut state = SyncState::default();
        for cid in missing {
            state
                .missing
                .insert(self.get(Some(id), cid, providers.iter().copied()));
        }
        if state.missing.is_empty() {
            state.children.insert(self.missing_blocks(id, cid));
        }
        state.providers = providers;
        let query = Query {
            hdr: Header {
                id,
                root: id,
                parent: None,
                cid,
                timer,
                label: "sync",
            },
            state: State::Sync(state),
        };
        self.queries.insert(id, query);
        id
    }
pub fn sync ( & mut self , cid : Cid , providers : Vec < PeerId > , missing : impl Iterator < Item = Cid > , ) -> QueryId { let timer = REQUEST_DURATION_SECONDS . with_label_values ( & [ " " ] ) . start_timer ( ) ; let id = QueryId ( self . id_counter ) ; self . id_counter += 1 ; tracing :: trace ! ( " " id id ) ; let mut state = SyncState :: default ( ) ; for cid in missing { state . missing . insert ( self . get ( Some ( id ) , cid , providers . iter ( ) . copied ( ) ) ) ; } if state . missing . is_empty ( ) { state . children . insert ( self . missing_blocks ( id , cid ) ) ; } state . providers = providers ; let query = Query { hdr : Header { id , root : id , parent : None , cid , timer , label : " " , } , state : State :: Sync ( state ) , } ; self . queries . insert ( id , query ) ; id }
Starts a query to recursively retrieve a dag.
Starts a query to recursively retrieve a dag .
&mut self
cid
Cid
providers
Vec<PeerId>
missing
impl Iterator<Item = Cid>
&mut self
cid
Cid
providers
Vec<PeerId>
missing
impl Iterator<Item = Cid>