Skip to content

Commit

Permalink
Add names to DataRead variant's fields
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Volodkin <[email protected]>
  • Loading branch information
vladem committed Sep 6, 2024
1 parent 6a91858 commit 53f0e67
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions mountpoint-s3/src/prefetch/backpressure_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down Expand Up @@ -90,7 +90,7 @@ impl BackpressureController {
pub async fn send_feedback<E>(&mut self, event: BackpressureFeedbackEvent) -> Result<(), PrefetchReadError<E>> {
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.
Expand Down
5 changes: 4 additions & 1 deletion mountpoint-s3/src/prefetch/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ impl<E: std::error::Error + Send + Sync> RequestTask<E> {

// 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;
Expand Down

0 comments on commit 53f0e67

Please sign in to comment.