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:
- Global byte budget — the sum of all
payload_bytesacross all enqueued messages must not exceedQueueConfig::max_total_bytes. - Per-peer message cap — a single peer may not have more than
QueueConfig::max_per_peer_messagesmessages pending (across all priority levels).
When either limit would be exceeded the incoming message is dropped and
QueueStats::total_dropped is incremented.
Structs§
- Peer
Priority Queue - Multi-level priority queue for outbound peer messages.
- Queue
Config - Configuration for
PeerPriorityQueue. - Queue
Stats - Running statistics for a
PeerPriorityQueue. - Queued
Message - A message waiting to be sent to a remote peer.
Enums§
- Message
Priority - Priority tier for a queued peer message.