pub trait FileWriter:
Send
+ Sync
+ FileRw {
// Required methods
fn write_block(&mut self, data: FBuf) -> Result<Arc<FBuf>, StorageError>;
fn complete(self: Box<Self>) -> Result<Arc<dyn FileReader>, 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, data: FBuf) -> Result<Arc<FBuf>, StorageError>
fn write_block(&mut self, data: FBuf) -> Result<Arc<FBuf>, StorageError>
Writes data at the end of the file. len()must be a multiple of 512. Returns the data that was written encapsulated in anArc`.
Sourcefn complete(self: Box<Self>) -> Result<Arc<dyn FileReader>, StorageError>
fn complete(self: Box<Self>) -> Result<Arc<dyn FileReader>, StorageError>
Completes writing of a file and returns a reader for the file.
The file will be deleted if the reader is dropped without calling FileReader::mark_for_checkpoint.
The file is not necessarily committed to stable storage before calling
commit on the returned file.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".