object_store

Function coalesce_ranges

source
pub async fn coalesce_ranges<F, E, Fut>(
    ranges: &[Range<usize>],
    fetch: F,
    coalesce: usize,
) -> Result<Vec<Bytes>, E>
where F: Send + FnMut(Range<usize>) -> Fut, E: Send, Fut: Future<Output = Result<Bytes, E>> + Send,
Expand description

Takes a function fetch that can fetch a range of bytes and uses this to fetch the provided byte ranges

To improve performance it will:

  • Combine ranges less than coalesce bytes apart into a single call to fetch
  • Make multiple fetch requests in parallel (up to maximum of 10)