Expand description
Backpressure: BytePermits
Byte-based flow control for write pumps.
Design principle:
- Backpressure scales with bytes, not message count
- One giant message should not starve other connections
- Pluggable:
NoOp(default) → Semaphore → dynamic policy
Usage:
ⓘ
let permits = SemaphorePermits::new(10 * 1024 * 1024); // 10MB limit
let permit = permits.acquire(n_bytes).await;
writer.write(buf).await;
drop(permit); // releases automaticallyStructs§
- NoOp
Permits - No-op implementation (Phase 0).
- Permit
- RAII permit guard.
- Semaphore
Permits - Semaphore-based backpressure implementation.
Traits§
- Byte
Permits - Backpressure permit trait.