Ring

Struct Ring 

Source
pub struct Ring { /* private fields */ }
Expand description

An I/O ring that manages asynchronous read and write operations. Provides facilities for both single and batch I/O operations with configurable parameters.

Implementations§

Source§

impl Ring

Source

pub fn create(config: &RingConfig, mount_point: &Path) -> Result<Self>

Creates a new I/O ring with the specified configuration and mount point.

§Arguments
  • config - Ring configuration parameters
  • mount_point - Mount point path for the filesystem
§Returns
  • Result<Self> - A new Ring instance or an error
Source

pub fn read(&mut self, file: &File, offset: u64, length: usize) -> Result<&[u8]>

Performs a single read operation.

§Arguments
  • file - The file to read from
  • offset - Starting position for the read
  • length - Number of bytes to read
§Returns
  • Result<&[u8]> - The read data as a byte slice or an error
Source

pub fn batch_read( &mut self, jobs: &[impl ReadJob], ) -> Result<Vec<ReadResult<'_>>>

Performs multiple read operations in a batch.

§Arguments
  • jobs - Slice of read operations to perform
§Returns
  • Result<Vec<ReadResult<'_>>> - Vector of read results or an error
§Errors
  • Returns error if number of jobs exceeds ring entries
  • Returns error if total read length exceeds buffer size
Source

pub fn write(&mut self, file: &File, buf: &[u8], offset: u64) -> Result<usize>

Performs a single write operation.

§Arguments
  • file - The file to write to
  • buf - Data to write
  • offset - Starting position for the write
§Returns
  • Result<usize> - Number of bytes written or an error
Source

pub fn batch_write(&mut self, jobs: &[impl WriteJob]) -> Result<Vec<i64>>

Performs multiple write operations in a batch.

§Arguments
  • jobs - Slice of write operations to perform
§Returns
  • Result<Vec<i64>> - Vector of write results (bytes written) or an error
§Errors
  • Returns error if number of jobs exceeds ring entries
  • Returns error if total write length exceeds buffer size

Auto Trait Implementations§

§

impl Freeze for Ring

§

impl RefUnwindSafe for Ring

§

impl !Send for Ring

§

impl !Sync for Ring

§

impl Unpin for Ring

§

impl UnwindSafe for Ring

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.