Skip to main content

HostRing

Struct HostRing 

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

Default in-process ring backed by a Vec<u8>. Both RingProducer and RingConsumer are implemented on a single &mut /& borrow so the producer-consumer parity test can drive both halves with the same buffer.

Implementations§

Source§

impl HostRing

Source

pub fn new(slot_count: u32) -> Result<Self, ProtocolError>

Allocate a new ring of slot_count empty slots.

§Errors

Returns ProtocolError::ByteLengthOverflow if slot_count exceeds protocol::MAX_ENCODED_RING_SLOTS.

Source

pub fn as_bytes(&self) -> &[u8]

Borrow the underlying ring bytes (for the dispatch path that still consumes &[u8] directly).

Source

pub fn as_bytes_mut(&mut self) -> &mut [u8]

Mutably borrow the underlying ring bytes.

Trait Implementations§

Source§

impl RingConsumer for HostRing

Source§

fn read_slot(&self, slot_idx: u32, out: &mut [u8]) -> Result<(), ProtocolError>

Copy slot slot_idx’s bytes into out. out must be exactly SLOT_BYTES long; otherwise returns ProtocolError::MisalignedByteLength.
Source§

fn try_done_count(&self) -> Result<u32, ProtocolError>

Fallibly count slots currently in DONE status. Read more
Source§

fn slot_count(&self) -> u32

Number of slots in the underlying ring.
Source§

fn done_count(&self) -> u32

👎Deprecated:

use RingConsumer::try_done_count so malformed ring snapshots do not collapse to zero

Compatibility-only lossy count of slots currently in DONE status. Read more
Source§

impl RingProducer for HostRing

Source§

fn publish( &mut self, slot_idx: u32, encoded: &[u8], ) -> Result<(), ProtocolError>

Publish encoded into slot_idx. encoded must be exactly SLOT_BYTES long; otherwise returns ProtocolError::MisalignedByteLength.
Source§

fn slot_count(&self) -> u32

Number of slots in the underlying ring.
Source§

fn name(&self) -> &'static str

Stable identifier for telemetry (e.g. "in-process-host", "uring-cmd-nvme", "gds").

Auto Trait Implementations§

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more