pub struct SegmentChunkQueue { /* private fields */ }Implementations§
Source§impl SegmentChunkQueue
impl SegmentChunkQueue
pub fn new(capacity: usize) -> Self
pub fn capacity(&self) -> usize
pub fn is_closed(&self) -> bool
pub fn pushed_segments(&self) -> usize
pub fn popped_segments(&self) -> usize
Sourcepub async fn push(&self, chunk: SegmentChunk) -> bool
pub async fn push(&self, chunk: SegmentChunk) -> bool
Push one segment chunk. Awaits capacity. Returns false if
closed before the chunk could be enqueued.
Sourcepub async fn pop(&self) -> Option<SegmentChunk>
pub async fn pop(&self) -> Option<SegmentChunk>
Pop one chunk. Blocks until one is available. Returns None
only once the queue is closed and drained.
Sourcepub fn push_front(&self, chunk: SegmentChunk) -> bool
pub fn push_front(&self, chunk: SegmentChunk) -> bool
Put a chunk back at the FRONT of the queue. Bypasses capacity
(a requeued chunk briefly exceeds capacity by 1; the queue
drains back under capacity at the next pop). Used by encoder
workers that pop a chunk, observe a cross-vendor codec
invariant mismatch, and need to hand the chunk off to another
worker. Decrements popped_segments so the dispatcher’s
pushed > popped predicate still reflects work-remaining.
Returns false if the queue is closed AND no other consumer
can pick the chunk up — in which case the caller should treat
this chunk as orphaned and the run will fail coverage.