Skip to main content

Module backpressure

Module backpressure 

Source
Expand description

Credit-Based Backpressure & Flow Control — FR-003

Implements credit-based flow control for K2K messaging:

  • Producer requests credits from consumer before sending
  • Consumer grants credits based on available queue capacity
  • When credits exhausted: producer blocks, buffers, or drops (configurable)
  • Queue watermark signals: LOW_WATER / HIGH_WATER
  • Per-channel flow control

§Protocol

Producer                          Consumer
   │                                  │
   │── RequestCredits(n) ──────────►  │
   │                                  │── GrantCredits(n) ─►
   │◄── GrantCredits(n) ──────────── │
   │                                  │
   │── Message (credit-1) ─────────► │
   │── Message (credit-1) ─────────► │
   │── Message (credit-1) ─────────► │
   │   (credits exhausted)            │
   │── RequestCredits(n) ──────────►  │
   │   ...                            │

Structs§

FlowControlConfig
Flow control configuration for a K2K channel.
FlowController
Per-channel flow controller.
FlowMetrics
Flow control metrics.
FlowMetricsSnapshot
Snapshot of flow control metrics (non-atomic, for reporting).

Enums§

OverflowPolicy
Policy when producer has no credits left.
WatermarkSignal
Watermark signal emitted when queue depth crosses thresholds.