Expand description
§Multi-Level Priority Queue with Anti-Starvation Aging
Provides a five-level priority queue where low-priority items are
automatically promoted (“aged”) when they have waited longer than the
configured threshold. This prevents starvation of Priority::Background
items under sustained Priority::Critical load.
§Example
use tokio_prompt_orchestrator::priority_queue::{
AgingConfig, MultiLevelQueue, Priority,
};
let config = AgingConfig::default();
let queue: MultiLevelQueue<String> = MultiLevelQueue::new(config);
queue.push("critical task".into(), Priority::Critical);
queue.push("background task".into(), Priority::Background);
// Critical pops first.
assert_eq!(queue.pop(), Some("critical task".into()));
assert_eq!(queue.pop(), Some("background task".into()));
assert_eq!(queue.pop(), None);Structs§
- Aging
Config - Per-level aging thresholds and promotion caps.
- Multi
Level Queue - Thread-safe multi-level priority queue with anti-starvation aging.
- Priority
Item - A wrapped item with priority metadata.
- Queue
Stats - Aggregate statistics for a
MultiLevelQueue.
Enums§
- Priority
- Five discrete priority levels. Lower numeric value = higher urgency.