Skip to main content

ZeroCopyStreamer

Trait ZeroCopyStreamer 

Source
pub trait ZeroCopyStreamer: Send {
    // Required methods
    fn async_read_chunk(&mut self, offset: u64) -> Result<(), IoError>;
    fn poll_completion(&mut self) -> Option<&[u8]>;
    fn get_active_buffer(&self) -> &[u8] ;
    fn buffer_size(&self) -> usize;
}
Expand description

Platform-agnostic zero-copy streaming interface.

This trait abstracts over Linux io_uring and Windows IOCP, providing a consistent API for asynchronous DMA transfers. The host guarantees that one buffer is always safely mutable by the OS while the core reads from the other.

Required Methods§

Source

fn async_read_chunk(&mut self, offset: u64) -> Result<(), IoError>

Issues an asynchronous hardware read into the INACTIVE buffer.

§Errors

Returns an error if the offset is not 4096-byte aligned. Both O_DIRECT and FILE_FLAG_NO_BUFFERING require strict sector alignment.

Source

fn poll_completion(&mut self) -> Option<&[u8]>

Non-blocking poll for completion.

Returns Some(&[u8]) only if the hardware has completed the DMA transfer into the inactive buffer. Upon returning Some, internally swaps active/inactive pointers.

Returns None if the transfer is still in progress.

Source

fn get_active_buffer(&self) -> &[u8]

Returns the currently active buffer for SIMD chunking.

This buffer is guaranteed to be stable and readable by the core.

Source

fn buffer_size(&self) -> usize

Returns the buffer size in bytes.

Implementors§

Source§

impl ZeroCopyStreamer for IoUringGridManager

Available on Linux only.