Skip to content

Commit

Permalink
Implement PieceCache::read_pieces() for ClusterPieceGetter
Browse files Browse the repository at this point in the history
  • Loading branch information
nazar-pc committed Oct 18, 2024
1 parent 65a5325 commit d9d2cc0
Show file tree
Hide file tree
Showing 5 changed files with 305 additions and 33 deletions.
14 changes: 1 addition & 13 deletions crates/subspace-farmer-components/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,7 @@ pub trait PieceGetter {
Box<dyn Stream<Item = (PieceIndex, anyhow::Result<Option<Piece>>)> + Send + Unpin + 'a>,
>
where
PieceIndices: IntoIterator<Item = PieceIndex, IntoIter: Send> + Send + 'a,
{
// TODO: Remove default impl here
Ok(Box::new(
piece_indices
.into_iter()
.map(|piece_index| async move {
let result = self.get_piece(piece_index).await;
(piece_index, result)
})
.collect::<FuturesUnordered<_>>(),
) as Box<_>)
}
PieceIndices: IntoIterator<Item = PieceIndex, IntoIter: Send> + Send + 'a;
}

#[async_trait]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ struct RocmPlottingOptions {
pub(super) struct PlotterArgs {
/// Piece getter concurrency.
///
/// Increasing this value can cause NATS communication issues if too many messages arrive via NATS, but
/// are not processed quickly enough.
/// Increasing this value can cause NATS communication issues if too many messages arrive via
/// NATS, but are not processed quickly enough.
#[arg(long, default_value = "32")]
piece_getter_concurrency: NonZeroUsize,
/// Plotting options only used by CPU plotter
Expand Down
2 changes: 1 addition & 1 deletion crates/subspace-farmer/src/cluster/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ impl GenericStreamRequest for ClusterCacheReadPiecesRequest {
type Response = Result<(PieceCacheOffset, Option<(PieceIndex, Piece)>), String>;
}

/// Request plotted from farmer, request
/// Collect plotted pieces from farmer
#[derive(Debug, Clone, Encode, Decode)]
struct ClusterCacheContentsRequest;

Expand Down
Loading

0 comments on commit d9d2cc0

Please sign in to comment.