subspace_data_retrieval::piece_getter

Function get_pieces_individually

Source
pub fn get_pieces_individually<'a, PieceIndices, Func, Fut>(
    get_piece: Func,
    piece_indices: PieceIndices,
) -> Result<Box<dyn Stream<Item = (PieceIndex, Result<Option<Piece>>)> + Send + Unpin + 'a>>
where PieceIndices: IntoIterator<Item = PieceIndex, IntoIter: Send> + Send + 'a, Func: Fn(PieceIndex) -> Fut + Clone + Send + 'a, Fut: Future<Output = Result<Option<Piece>>> + Send + Unpin + 'a,
Expand description

A default implementation which gets each piece individually, using the get_piece async function.

This is mainly used for testing, most production implementations can fetch multiple pieces more efficiently.