Trait bao_tree::io::tokio::AsyncSliceReader
source · pub trait AsyncSliceReader {
// Required methods
fn read_at<'a, 'b, 'r>(
&'a mut self,
offset: u64,
buf: &'b mut [u8]
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'r>>
where Self: 'r,
'a: 'r,
'b: 'r;
fn len<'a, 'r>(
&'a mut self
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'r>>
where Self: 'r,
'a: 'r;
}Expand description
A reader that can read a slice at a specified offset
For a file, this will be implemented by seeking to the offset and then reading the data. For other types of storage, seeking is not necessary. E.g. a Bytes or a memory mapped slice already allows random access.
For external storage such as S3/R2, this might be implemented in terms of async http requests.
This is similar to the io interface of sqlite. See xRead, xFileSize in https://www.sqlite.org/c3ref/io_methods.html