pub struct UploadRing { /* private fields */ }Expand description
A bounded host staging ring independent of any concrete GPU backend.
Implementations§
Source§impl UploadRing
impl UploadRing
Sourcepub fn new(config: UploadRingConfig) -> Result<Self, UploadBackpressure>
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.
Sourcepub fn begin_epoch(&mut self)
pub fn begin_epoch(&mut self)
Resets only the per-epoch payload counter.
Sourcepub fn reserve(
&mut self,
byte_len: usize,
) -> Result<UploadReservation, UploadBackpressure>
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.
Sourcepub fn bytes_mut(
&mut self,
reservation: UploadReservation,
) -> Result<&mut [u8], UploadBackpressure>
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.
Sourcepub fn commit(&mut self, ticket: UploadTicket) -> Result<(), UploadBackpressure>
pub fn commit(&mut self, ticket: UploadTicket) -> Result<(), UploadBackpressure>
Sourcepub fn submit(
&mut self,
ticket: UploadTicket,
fence: FenceValue,
) -> Result<(), UploadBackpressure>
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.
Sourcepub fn ensure_submittable(
&mut self,
ticket: UploadTicket,
) -> Result<(), UploadBackpressure>
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.
Sourcepub fn cancel(&mut self, ticket: UploadTicket) -> Result<(), UploadBackpressure>
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.
Sourcepub fn retire(&mut self, completed: FenceValue) -> Retirement
pub fn retire(&mut self, completed: FenceValue) -> Retirement
Retires the contiguous FIFO prefix whose submission fences completed.
Sourcepub fn state(&self, ticket: UploadTicket) -> Option<UploadState>
pub fn state(&self, ticket: UploadTicket) -> Option<UploadState>
Current lifecycle for a live ticket.
Sourcepub const fn metrics(&self) -> UploadMetrics
pub const fn metrics(&self) -> UploadMetrics
Current cumulative counters.
Sourcepub fn staging_bytes(&self) -> &[u8] ⓘ
pub fn staging_bytes(&self) -> &[u8] ⓘ
Entire staging storage for backend copy commands.