From 53f0e67709afe1dce83f455b5ce5aa6ad11ebb20 Mon Sep 17 00:00:00 2001 From: Vladislav Volodkin Date: Fri, 6 Sep 2024 12:32:26 +0000 Subject: [PATCH] Add names to DataRead variant's fields Signed-off-by: Vladislav Volodkin --- mountpoint-s3/src/prefetch/backpressure_controller.rs | 4 ++-- mountpoint-s3/src/prefetch/task.rs | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/mountpoint-s3/src/prefetch/backpressure_controller.rs b/mountpoint-s3/src/prefetch/backpressure_controller.rs index a4878225e..b44a5093b 100644 --- a/mountpoint-s3/src/prefetch/backpressure_controller.rs +++ b/mountpoint-s3/src/prefetch/backpressure_controller.rs @@ -8,7 +8,7 @@ use super::PrefetchReadError; #[derive(Debug)] pub enum BackpressureFeedbackEvent { /// An event where data with a certain length has been read out of the stream - DataRead(u64, usize), + DataRead { offset: u64, length: usize }, /// An event indicating part queue stall PartQueueStall, } @@ -90,7 +90,7 @@ impl BackpressureController { pub async fn send_feedback(&mut self, event: BackpressureFeedbackEvent) -> Result<(), PrefetchReadError> { match event { // Note, that this may come from a backwards seek, so offsets observed by this method are not necessarily ascending - BackpressureFeedbackEvent::DataRead(offset, length) => { + BackpressureFeedbackEvent::DataRead { offset, length } => { let next_read_offset = offset + length as u64; let remaining_window = self.read_window_end_offset.saturating_sub(next_read_offset); // Increment the read window only if the remaining window reaches some threshold i.e. half of it left. diff --git a/mountpoint-s3/src/prefetch/task.rs b/mountpoint-s3/src/prefetch/task.rs index 45201008b..c4de1e125 100644 --- a/mountpoint-s3/src/prefetch/task.rs +++ b/mountpoint-s3/src/prefetch/task.rs @@ -55,7 +55,10 @@ impl RequestTask { // We read some data out of the part queue so the read window should be moved self.backpressure_controller - .send_feedback(DataRead(part.offset(), part.len())) + .send_feedback(DataRead { + offset: part.offset(), + length: part.len(), + }) .await?; let next_offset = part.offset() + part.len() as u64;