pub struct PriorityStreamQueue { /* private fields */ }Expand description
Lock-light 4-lane priority work-stealing streaming queue with request coalescing, dynamic reprioritization, and atomic cancellation.
Implementations§
Source§impl PriorityStreamQueue
Coalescing, reprioritization, work-stealing pop, and atomic cancellation routines for PriorityStreamQueue.
impl PriorityStreamQueue
Coalescing, reprioritization, work-stealing pop, and atomic cancellation routines for PriorityStreamQueue.
Sourcepub fn enqueue_or_coalesce(
&self,
item: StreamWorkItem,
telemetry: &StreamingTelemetryCounters,
) -> (StreamRequestHandle, bool)
pub fn enqueue_or_coalesce( &self, item: StreamWorkItem, telemetry: &StreamingTelemetryCounters, ) -> (StreamRequestHandle, bool)
Enqueues or coalesces an asset streaming job using StreamWorkItem parameters, escalating lane priority and tier when a higher-urgency requester arrives.
§Arguments
StreamWorkItem- Initial job specification (generation is assigned by the queue).&StreamingTelemetryCounters- Lock-free telemetry counters updated atomically.
§Returns
(StreamRequestHandle, bool)- Request handle paired withtruewhen newly enqueued orfalsewhen coalesced.
Sourcepub fn reprioritize(&self, key_hash: u64, new_priority: StreamPriority) -> bool
pub fn reprioritize(&self, key_hash: u64, new_priority: StreamPriority) -> bool
Sourcepub fn cancel(
&self,
key_hash: u64,
telemetry: &StreamingTelemetryCounters,
) -> bool
pub fn cancel( &self, key_hash: u64, telemetry: &StreamingTelemetryCounters, ) -> bool
Sourcepub fn is_active_generation(&self, key_hash: u64, generation: u64) -> bool
pub fn is_active_generation(&self, key_hash: u64, generation: u64) -> bool
Sourcepub fn mark_completed(
&self,
key_hash: u64,
generation: u64,
telemetry: &StreamingTelemetryCounters,
) -> bool
pub fn mark_completed( &self, key_hash: u64, generation: u64, telemetry: &StreamingTelemetryCounters, ) -> bool
Completes (key_hash, generation), removing it from the coalescing registry and decrementing active_jobs exactly once.
§Arguments
u64- Asset key hash.u64- Generation stamped on the finished work item.&StreamingTelemetryCounters- Lock-free telemetry counters.
§Returns
bool-truewhen the job was still active and completed cleanly,falseif already cancelled or superseded.
Sourcepub fn pop_highest_priority(&self) -> Option<StreamWorkItem>
pub fn pop_highest_priority(&self) -> Option<StreamWorkItem>
Pops the highest-priority valid work item across all 4 lanes with a lock-free fast-path when empty.
§Returns
Option<StreamWorkItem>- Highest-priority live work item orNonewhen empty.
Sourcepub fn pop_or_steal(&self, worker_index: usize) -> Option<StreamWorkItem>
pub fn pop_or_steal(&self, worker_index: usize) -> Option<StreamWorkItem>
Sourcepub fn wait_pop_or_steal(&self, worker_index: usize) -> Option<StreamWorkItem>
pub fn wait_pop_or_steal(&self, worker_index: usize) -> Option<StreamWorkItem>
Sourcepub fn request_shutdown(&self)
pub fn request_shutdown(&self)
Signals all parked background worker threads to exit cleanly.
Sourcepub fn is_shutdown(&self) -> bool
pub fn is_shutdown(&self) -> bool
Returns true when shutdown has been signaled on this queue.
§Returns
bool- Whether queue shutdown was requested.
Sourcepub fn lane_len(&self, priority: StreamPriority) -> usize
pub fn lane_len(&self, priority: StreamPriority) -> usize
Sourcepub fn active_count(&self) -> usize
pub fn active_count(&self) -> usize
Returns the exact number of active coalesced in-flight requests.
§Returns
usize- Count of live in-flight request entries.