|
KEEL 1.0.0
Minimal C11 HTTP client/server library built on epoll/kqueue/io_uring/poll
|
Backpressure write buffer. More...
#include <drain.h>

Data Fields | |
| KlDrainWriteFn | write_fn |
| void * | write_ctx |
| KlDrainCb | on_drain |
| void * | drain_ctx |
| KlAllocator * | alloc |
| char * | buf |
| size_t | buf_len |
| size_t | buf_cap |
| size_t | max_size |
| int | error |
Backpressure write buffer.
Sits between a producer (SSE, compress stream, WebSocket, etc.) and a writer function. When the writer returns would-block (0), KlDrain buffers the remaining data. The caller composes KlDrain with KlWatcher / KlAsyncOp to resume on write-readiness — KlDrain itself has zero event loop dependency.
Caller-owned struct (stack-allocatable). NOT thread-safe.
| KlDrainWriteFn KlDrain::write_fn |
Underlying writer
| void* KlDrain::write_ctx |
Writer context
| KlDrainCb KlDrain::on_drain |
Optional: buffer-drained callback
| void* KlDrain::drain_ctx |
Callback context
| KlAllocator* KlDrain::alloc |
For buffer allocation
| char* KlDrain::buf |
Pending data (lazy-allocated)
| size_t KlDrain::buf_len |
Bytes pending
| size_t KlDrain::buf_cap |
Buffer capacity
| size_t KlDrain::max_size |
0 = unlimited, else hard cap
| int KlDrain::error |
Sticky error flag