/// The method checks if a download from a peer can be initiated.
///
/// A peer may not be ready for downloads for various reasons:
///
/// a) The peer's download request capacity has been reached.</br>
/// b) The peer is not a current peer (e.g., it is an unknown peer or a peer
/// that was removed)</br>
/// c) The peer was disconnected (TODO -  P2P512)
The method checks if a download from a peer can be initiated.
A peer may not be ready for downloads for various reasons.

a) The peer's download request capacity has been reached.
b) The peer is not a current peer 
c) The peer was disconnected (TODO -  P2P512)
The method checks if a download from a peer can be initiated . A peer may not be ready for downloads for various reasons . a ) The peer ' s download request capacity has been reached . b ) The peer is not a current peer c ) The peer was disconnected ( TODO - P2P512 )
fn is_peer_ready_for_download<'a>(
        &self,
        peer_id: NodeId,
        peer_dictionary: &'a PeerContextDictionary,
    ) -> Result<&'a PeerContext, P2PError> {
        match peer_dictionary.get(&peer_id) {
            // Check that the peer is present and
            // there is available capacity to stream chunks from this peer.
            Some(peer_context)
                if peer_context.requested.len()
                    < self.gossip_config.max_artifact_streams_per_peer as usize =>
            {
                Ok(peer_context)
            }
            _ => Err(P2PError {
                p2p_error_code: P2PErrorCode::Busy,
            }),
        }
    }
fn is_peer_ready_for_download < ' a > ( & self , peer_id : NodeId , peer_dictionary : & ' a PeerContextDictionary , ) -> Result < & ' a PeerContext , P2PError > { match peer_dictionary . get ( & peer_id ) { // Check that the peer is present and // there is available capacity to stream chunks from this peer. Some ( peer_context ) if peer_context . requested . len ( ) < self . gossip_config . max_artifact_streams_per_peer as usize => { Ok ( peer_context ) } _ => Err ( P2PError { p2p_error_code : P2PErrorCode :: Busy , } ) , } }
The method checks if a download from a peer can be initiated.
The method checks if a download from a peer can be initiated .
&self
peer_id
NodeId
peer_dictionary
&'a PeerContextDictionary