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§
- Flow
Control Config - Flow control configuration for a K2K channel.
- Flow
Controller - Per-channel flow controller.
- Flow
Metrics - Flow control metrics.
- Flow
Metrics Snapshot - Snapshot of flow control metrics (non-atomic, for reporting).
Enums§
- Overflow
Policy - Policy when producer has no credits left.
- Watermark
Signal - Watermark signal emitted when queue depth crosses thresholds.