pub trait FileWriter:
Send
+ Sync
+ HasFileId {
// Required methods
fn write_block(
&mut self,
offset: u64,
data: FBuf,
) -> Result<Arc<FBuf>, StorageError>;
fn complete(
self: Box<Self>,
) -> Result<(Arc<dyn FileReader>, StoragePath), StorageError>;
}Expand description
A file being written.
The file can’t be read until it is completed with FileWriter::complete. Until then, the file is temporary and will be deleted if it is dropped.
Required Methods§
Sourcefn write_block(
&mut self,
offset: u64,
data: FBuf,
) -> Result<Arc<FBuf>, StorageError>
fn write_block( &mut self, offset: u64, data: FBuf, ) -> Result<Arc<FBuf>, StorageError>
Writes data at the given byte offset. offset must be a multiple
of 512 and data.len() must be a multiple of 512. Returns the data
that was written encapsulated in an Arc.
Sourcefn complete(
self: Box<Self>,
) -> Result<(Arc<dyn FileReader>, StoragePath), StorageError>
fn complete( self: Box<Self>, ) -> Result<(Arc<dyn FileReader>, StoragePath), StorageError>
Completes writing of a file and returns a reader for the file and the file’s path. The file is treated as temporary and will be deleted if the reader is dropped without first calling FileReader::mark_for_checkpoint.