Trait bao_tree::io::fsm::AsyncSliceWriter
source · pub trait AsyncSliceWriter: Sized {
type WriteFuture: Future<Output = (Self, Result<()>)> + Send;
// Required methods
fn write_at(self, offset: u64, data: Bytes) -> Self::WriteFuture;
fn write_array_at<const N: usize>(
self,
offset: u64,
bytes: [u8; N]
) -> Self::WriteFuture;
}Expand description
A writer that can write a slice at a specified offset
Will extend the file if the offset is past the end of the file, just like posix and windows files do.
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 xWrite in https://www.sqlite.org/c3ref/io_methods.html
Required Associated Types§
Required Methods§
sourcefn write_at(self, offset: u64, data: Bytes) -> Self::WriteFuture
fn write_at(self, offset: u64, data: Bytes) -> Self::WriteFuture
Write the entire Bytes at the given position
sourcefn write_array_at<const N: usize>(
self,
offset: u64,
bytes: [u8; N]
) -> Self::WriteFuture
fn write_array_at<const N: usize>( self, offset: u64, bytes: [u8; N] ) -> Self::WriteFuture
Write an owned byte array at the given position
This is an alternative to write_at for small, fixed sized writes where converting to a Bytes would have too much overhead.