Skip to content

Commit 64df00e

Browse files
authored
Merge pull request #3149 from autonomys/batches-in-cluster-piece-getter
Batches in `ClusterPieceGetter`
2 parents ebd4a0a + d9d2cc0 commit 64df00e

File tree

12 files changed

+452
-46
lines changed

12 files changed

+452
-46
lines changed

Cargo.lock

Lines changed: 51 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/subspace-farmer-components/src/lib.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,7 @@ pub trait PieceGetter {
5454
Box<dyn Stream<Item = (PieceIndex, anyhow::Result<Option<Piece>>)> + Send + Unpin + 'a>,
5555
>
5656
where
57-
PieceIndices: IntoIterator<Item = PieceIndex, IntoIter: Send> + Send + 'a,
58-
{
59-
// TODO: Remove default impl here
60-
Ok(Box::new(
61-
piece_indices
62-
.into_iter()
63-
.map(|piece_index| async move {
64-
let result = self.get_piece(piece_index).await;
65-
(piece_index, result)
66-
})
67-
.collect::<FuturesUnordered<_>>(),
68-
) as Box<_>)
69-
}
57+
PieceIndices: IntoIterator<Item = PieceIndex, IntoIter: Send> + Send + 'a;
7058
}
7159

7260
#[async_trait]

crates/subspace-farmer/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ hwlocality = { version = "1.0.0-alpha.6", features = ["vendored"], optional = tr
3939
jsonrpsee = { version = "0.24.5", features = ["ws-client"] }
4040
mimalloc = { version = "0.1.43", optional = true }
4141
num_cpus = "1.16.0"
42+
ouroboros = "0.18.4"
4243
parity-scale-codec = "3.6.12"
4344
parking_lot = "0.12.2"
4445
pin-project = "1.1.5"

crates/subspace-farmer/src/bin/subspace-farmer/commands/cluster/plotter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ struct RocmPlottingOptions {
125125
pub(super) struct PlotterArgs {
126126
/// Piece getter concurrency.
127127
///
128-
/// Increasing this value can cause NATS communication issues if too many messages arrive via NATS, but
129-
/// are not processed quickly enough.
128+
/// Increasing this value can cause NATS communication issues if too many messages arrive via
129+
/// NATS, but are not processed quickly enough.
130130
#[arg(long, default_value = "32")]
131131
piece_getter_concurrency: NonZeroUsize,
132132
/// Plotting options only used by CPU plotter

crates/subspace-farmer/src/cluster/cache.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl GenericStreamRequest for ClusterCacheReadPiecesRequest {
9090
type Response = Result<(PieceCacheOffset, Option<(PieceIndex, Piece)>), String>;
9191
}
9292

93-
/// Request plotted from farmer, request
93+
/// Collect plotted pieces from farmer
9494
#[derive(Debug, Clone, Encode, Decode)]
9595
struct ClusterCacheContentsRequest;
9696

@@ -132,7 +132,7 @@ impl PieceCache for ClusterPieceCache {
132132
> {
133133
Ok(Box::new(
134134
self.nats_client
135-
.stream_request(ClusterCacheContentsRequest, Some(&self.cache_id_string))
135+
.stream_request(&ClusterCacheContentsRequest, Some(&self.cache_id_string))
136136
.await?
137137
.map(|response| response.map_err(FarmError::from)),
138138
))
@@ -200,7 +200,7 @@ impl PieceCache for ClusterPieceCache {
200200
let mut stream = self
201201
.nats_client
202202
.stream_request(
203-
ClusterCacheReadPiecesRequest { offsets },
203+
&ClusterCacheReadPiecesRequest { offsets },
204204
Some(&self.cache_id_string),
205205
)
206206
.await?

0 commit comments

Comments
 (0)