Skip to content

Commit 4b87b6d

Browse files
committed
Add len to notify_payload_write
1 parent 6d86e4f commit 4b87b6d

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/provider.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,10 @@ impl WriterContext {
234234

235235
impl WriteProgress for WriterContext {
236236
async fn notify_payload_write(&mut self, _index: u64, offset: u64, len: usize) {
237-
let end_offset = offset + len as u64;
238-
self.payload_bytes_written += len as u64;
239-
self.tracker.transfer_progress(end_offset).await.ok();
237+
let len = len as u64;
238+
let end_offset = offset + len;
239+
self.payload_bytes_written += len;
240+
self.tracker.transfer_progress(len, end_offset).await.ok();
240241
}
241242

242243
fn log_other_write(&mut self, len: usize) {

src/provider/events.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ impl RequestTracker {
222222
}
223223

224224
/// Transfer progress for the previously reported blob, end_offset is the new end offset in bytes.
225-
pub async fn transfer_progress(&mut self, end_offset: u64) -> ClientResult {
225+
pub async fn transfer_progress(&mut self, len: u64, end_offset: u64) -> ClientResult {
226226
if let RequestUpdates::Active(tx) = &mut self.updates {
227227
tx.try_send(RequestUpdate::Progress(TransferProgress { end_offset }))
228228
.await?;
@@ -232,6 +232,7 @@ impl RequestTracker {
232232
.rpc(Throttle {
233233
connection_id: *connection_id,
234234
request_id: *request_id,
235+
size: len as u64,
235236
})
236237
.await??;
237238
}
@@ -546,6 +547,8 @@ mod proto {
546547
pub connection_id: u64,
547548
/// The request id. There is a new id for each request.
548549
pub request_id: u64,
550+
/// Size of the chunk to be throttled. This will usually be 16 KiB.
551+
pub size: u64,
549552
}
550553

551554
#[derive(Debug, Serialize, Deserialize)]

0 commit comments

Comments
 (0)