Skip to main content

UploadRing

Struct UploadRing 

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

A bounded host staging ring independent of any concrete GPU backend.

Implementations§

Source§

impl UploadRing

Source

pub fn new(config: UploadRingConfig) -> Result<Self, UploadBackpressure>

Allocates byte and ticket storage once.

§Errors

Returns UploadBackpressure::InvalidConfiguration for empty capacities, zero budget or non-power-of-two alignment.

Source

pub fn begin_epoch(&mut self)

Resets only the per-epoch payload counter.

Source

pub fn reserve( &mut self, byte_len: usize, ) -> Result<UploadReservation, UploadBackpressure>

Reserves one contiguous aligned staging range.

§Errors

Returns explicit backpressure without growing either storage vector.

Source

pub fn bytes_mut( &mut self, reservation: UploadReservation, ) -> Result<&mut [u8], UploadBackpressure>

Returns the writable payload range while a ticket is reserved.

§Errors

Returns UploadBackpressure::InvalidTicket for stale or already committed reservations.

Source

pub fn commit(&mut self, ticket: UploadTicket) -> Result<(), UploadBackpressure>

Marks filled bytes ready for backend submission.

§Errors

The ticket must currently be reserved.

Source

pub fn submit( &mut self, ticket: UploadTicket, fence: FenceValue, ) -> Result<(), UploadBackpressure>

Associates a ready upload with the fence of the submission reading it.

§Errors

The ticket must currently be ready.

Source

pub fn ensure_submittable( &mut self, ticket: UploadTicket, ) -> Result<(), UploadBackpressure>

Validates in-flight admission before a backend submission is issued.

§Errors

The ticket must be ready and fit the fixed in-flight byte budget.

Source

pub fn cancel(&mut self, ticket: UploadTicket) -> Result<(), UploadBackpressure>

Cancels a reservation that has not been submitted.

§Errors

In-flight and stale tickets cannot be cancelled.

Source

pub fn retire(&mut self, completed: FenceValue) -> Retirement

Retires the contiguous FIFO prefix whose submission fences completed.

Source

pub fn state(&self, ticket: UploadTicket) -> Option<UploadState>

Current lifecycle for a live ticket.

Source

pub const fn metrics(&self) -> UploadMetrics

Current cumulative counters.

Source

pub fn staging_bytes(&self) -> &[u8] ⓘ

Entire staging storage for backend copy commands.

Trait Implementations§

Source§

impl Debug for UploadRing

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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, 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.