pub struct PollSource<F> {
registered_source: RegisteredSource<F>,
}Expand description
Async wrapper for an IO source that uses the FD executor to drive async operations.
Fields§
§registered_source: RegisteredSource<F>Implementations§
Source§impl<F: AsRawDescriptor> PollSource<F>
impl<F: AsRawDescriptor> PollSource<F>
Sourcepub fn new(f: F, ex: &Arc<RawExecutor<EpollReactor>>) -> Result<Self>
pub fn new(f: F, ex: &Arc<RawExecutor<EpollReactor>>) -> Result<Self>
Create a new PollSource from the given IO source.
Source§impl<F: AsRawDescriptor> PollSource<F>
impl<F: AsRawDescriptor> PollSource<F>
Sourcepub async fn read_to_vec(
&self,
file_offset: Option<u64>,
vec: Vec<u8>,
) -> AsyncResult<(usize, Vec<u8>)>
pub async fn read_to_vec( &self, file_offset: Option<u64>, vec: Vec<u8>, ) -> AsyncResult<(usize, Vec<u8>)>
Reads from the iosource at file_offset and fill the given vec.
Sourcepub async fn read_to_mem(
&self,
file_offset: Option<u64>,
mem: Arc<dyn BackingMemory + Send + Sync>,
mem_offsets: impl IntoIterator<Item = MemRegion>,
) -> AsyncResult<usize>
pub async fn read_to_mem( &self, file_offset: Option<u64>, mem: Arc<dyn BackingMemory + Send + Sync>, mem_offsets: impl IntoIterator<Item = MemRegion>, ) -> AsyncResult<usize>
Reads to the given mem at the given offsets from the file starting at file_offset.
Sourcepub async fn wait_readable(&self) -> AsyncResult<()>
pub async fn wait_readable(&self) -> AsyncResult<()>
Wait for the FD of self to be readable.
Sourcepub async fn write_from_vec(
&self,
file_offset: Option<u64>,
vec: Vec<u8>,
) -> AsyncResult<(usize, Vec<u8>)>
pub async fn write_from_vec( &self, file_offset: Option<u64>, vec: Vec<u8>, ) -> AsyncResult<(usize, Vec<u8>)>
Writes from the given vec to the file starting at file_offset.
Sourcepub async fn write_from_mem(
&self,
file_offset: Option<u64>,
mem: Arc<dyn BackingMemory + Send + Sync>,
mem_offsets: impl IntoIterator<Item = MemRegion>,
) -> AsyncResult<usize>
pub async fn write_from_mem( &self, file_offset: Option<u64>, mem: Arc<dyn BackingMemory + Send + Sync>, mem_offsets: impl IntoIterator<Item = MemRegion>, ) -> AsyncResult<usize>
Writes from the given mem from the given offsets to the file starting at file_offset.
Sourcepub async fn fsync(&self) -> AsyncResult<()>
pub async fn fsync(&self) -> AsyncResult<()>
§Safety
Sync all completed write operations to the backing storage.
Sourcepub async fn punch_hole(&self, file_offset: u64, len: u64) -> AsyncResult<()>
pub async fn punch_hole(&self, file_offset: u64, len: u64) -> AsyncResult<()>
punch_hole
Sourcepub async fn write_zeroes_at(
&self,
file_offset: u64,
len: u64,
) -> AsyncResult<()>
pub async fn write_zeroes_at( &self, file_offset: u64, len: u64, ) -> AsyncResult<()>
write_zeroes_at
Sourcepub async fn fdatasync(&self) -> AsyncResult<()>
pub async fn fdatasync(&self) -> AsyncResult<()>
Sync all data of completed write operations to the backing storage, avoiding updating extra metadata.
Sourcepub fn into_source(self) -> F
pub fn into_source(self) -> F
Yields the underlying IO source.
Sourcepub fn as_source_mut(&mut self) -> &mut F
pub fn as_source_mut(&mut self) -> &mut F
Provides a mutable ref to the underlying IO source.
Auto Trait Implementations§
impl<F> Freeze for PollSource<F>where
F: Freeze,
impl<F> RefUnwindSafe for PollSource<F>where
F: RefUnwindSafe,
impl<F> Send for PollSource<F>where
F: Send,
impl<F> Sync for PollSource<F>where
F: Sync,
impl<F> Unpin for PollSource<F>where
F: Unpin,
impl<F> UnwindSafe for PollSource<F>where
F: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more