Skip to main content

Module priority_queue

Module priority_queue 

Source
Expand description

Multi-level priority queue for outbound peer messages.

Provides PeerPriorityQueue with three priority tiers (Urgent, Normal, Background), per-peer fairness enforcement, and a global byte-budget cap.

§Design

Messages are placed into one of three FIFO sub-queues based on their MessagePriority. On dequeue, the implementation drains the highest non-empty tier first (Urgent → Normal → Background), guaranteeing strict priority ordering while still allowing lower-priority traffic to be sent whenever the higher tiers are empty.

Backpressure is enforced in two independent dimensions:

When either limit would be exceeded the incoming message is dropped and QueueStats::total_dropped is incremented.

Structs§

PeerPriorityQueue
Multi-level priority queue for outbound peer messages.
QueueConfig
Configuration for PeerPriorityQueue.
QueueStats
Running statistics for a PeerPriorityQueue.
QueuedMessage
A message waiting to be sent to a remote peer.

Enums§

MessagePriority
Priority tier for a queued peer message.