pub(crate) fn new_partial_data(&mut self, data_id: &T, holder: NodeId) -> GossipAction {
        self.purge_finished();

        if self.finished.contains(data_id) {
            debug!(item=%data_id, "no further action: item already finished");
            return GossipAction::Noop;
        }

        let update = |state: &mut State| {
            let _ = state.holders.insert(holder);
        };

        if let Some(action) = self.update_current(data_id, update) {
            debug!(item=%data_id, %action, "item is currently being gossiped");
            return action;
        }

        // This isn't in finished or current - add a new entry to current.
        let mut state = State::default();
        update(&mut state);
        let is_new = true;
        let action = state.action(self.infection_target, self.holders_limit, is_new);
        let _ = self.current.insert(*data_id, state);
        debug!(item=%data_id, %action, "gossiping new item should begin");
        action
    }
/// We received knowledge about potentially new data with given ID from the given peer.  This
/// should only be called where we don't already hold everything locally we need to be able to
/// gossip it onwards.  If we are able to gossip the data already, call `new_data` instead.
///
/// Once we have retrieved everything we need in order to begin gossiping onwards, call
/// `new_data`.
///
/// Returns whether we should gossip it, and a list of peers to exclude.
We received knowledge about potentially new data with given ID from the given peer.  This
should only be called where we don't already hold everything locally we need to be able to
gossip it onwards.  If we are able to gossip the data already, call `new_data` instead.

Once we have retrieved everything we need in order to begin gossiping onwards, call
`new_data`.

Returns whether we should gossip it, and a list of peers to exclude.
We received knowledge about potentially new data with given ID from the given peer . This should only be called where we don ' t already hold everything locally we need to be able to gossip it onwards . If we are able to gossip the data already call ` new_data ` instead . Once we have retrieved everything we need in order to begin gossiping onwards call ` new_data ` . Returns whether we should gossip it and a list of peers to exclude .
pub(crate) fn new_partial_data(&mut self, data_id: &T, holder: NodeId) -> GossipAction {
        self.purge_finished();
        if self.finished.contains(data_id) {
            debug!(item=%data_id, "no further action: item already finished");
            return GossipAction::Noop;
        }
        let update = |state: &mut State| {
            let _ = state.holders.insert(holder);
        };
        if let Some(action) = self.update_current(data_id, update) {
            debug!(item=%data_id, %action, "item is currently being gossiped");
            return action;
        }
        // This isn't in finished or current - add a new entry to current.
        let mut state = State::default();
        update(&mut state);
        let is_new = true;
        let action = state.action(self.infection_target, self.holders_limit, is_new);
        let _ = self.current.insert(*data_id, state);
        debug!(item=%data_id, %action, "gossiping new item should begin");
        action
    }
pub ( crate ) fn new_partial_data ( & mut self , data_id : & T , holder : NodeId ) -> GossipAction { self . purge_finished ( ) ; if self . finished . contains ( data_id ) { debug ! ( item data_id " " ) ; return GossipAction :: Noop ; } let update = | state : & mut State | { let _ = state . holders . insert ( holder ) ; } ; if let Some ( action ) = self . update_current ( data_id , update ) { debug ! ( item data_id action " " ) ; return action ; } // This isn't in finished or current - add a new entry to current. let mut state = State :: default ( ) ; update ( & mut state ) ; let is_new = true ; let action = state . action ( self . infection_target , self . holders_limit , is_new ) ; let _ = self . current . insert ( * data_id , state ) ; debug ! ( item data_id action " " ) ; action }
We received knowledge about potentially new data with given ID from the given peer.
We received knowledge about potentially new data with given ID from the given peer .
&mut self
data_id
&T
holder
NodeId
&mut self
data_id
&T
holder
NodeId