Struct glommio::io::DmaStreamWriterBuilder
source · pub struct DmaStreamWriterBuilder { /* private fields */ }
Expand description
Builds a DmaStreamWriter, allowing linear access to a Direct I/O DmaFile
Implementations§
source§impl DmaStreamWriterBuilder
impl DmaStreamWriterBuilder
sourcepub fn new(file: DmaFile) -> DmaStreamWriterBuilder
pub fn new(file: DmaFile) -> DmaStreamWriterBuilder
Creates a new DmaStreamWriterBuilder, given a DmaFile
Various properties can be set by using its with
methods.
A DmaStreamWriter
can later be constructed from it by
calling build
Examples
use glommio::{
io::{DmaFile, DmaStreamWriterBuilder},
LocalExecutor,
};
let ex = LocalExecutor::default();
ex.run(async {
let file = DmaFile::create("myfile.txt").await.unwrap();
let _reader = DmaStreamWriterBuilder::new(file).build();
});
sourcepub fn with_write_behind(self, write_behind: usize) -> Self
pub fn with_write_behind(self, write_behind: usize) -> Self
Define the number of write-behind buffers that will be used by the
DmaStreamWriter
Higher write-behind numbers mean more parallelism but also more memory
usage. As long as there is still write-behind buffers available
writing to this DmaStreamWriter
will not block.
sourcepub fn with_sync_on_close_disabled(self, flush_disabled: bool) -> Self
pub fn with_sync_on_close_disabled(self, flush_disabled: bool) -> Self
Does not issue a sync operation when closing the file. This is dangerous and in most cases may lead to data loss.
sourcepub fn with_buffer_size(self, buffer_size: usize) -> Self
pub fn with_buffer_size(self, buffer_size: usize) -> Self
Define the buffer size that will be used by the DmaStreamWriter
sourcepub fn build(self) -> DmaStreamWriter
pub fn build(self) -> DmaStreamWriter
Builds a DmaStreamWriter
with the properties defined by this
DmaStreamWriterBuilder