TSIOBUFFERCREATE(3ts)
πΈ NAME πΈ
TSIOBufferCreate β traffic Server IO buffer API
okay so first things first: this is the TSIOBUFFERCREATE(3ts) page from the Apache Traffic Server manual, and it's all about the IO buffer API. yes bestie, we're doing Traffic Server internals and we're gonna make it cute. π
β¨ SYNOPSIS β¨
here's the exact include and the function signatures, no edits, no vibes-based changes:
#include <ts/ts.h>
TSIOBuffer TSIOBufferCreate(void)
TSIOBuffer TSIOBufferSizedCreate(TSIOBufferSizeIndex index)
void TSIOBufferDestroy(TSIOBuffer bufp)
int64_t TSIOBufferWrite(TSIOBuffer bufp, const void *buf, int64_t
length)
void TSIOBufferProduce(TSIOBuffer bufp, int64_t nbytes)
int64_t TSIOBufferWaterMarkGet(TSIOBuffer bufp)
void TSIOBufferWaterMarkSet(TSIOBuffer bufp, int64_t water_mark)
π DESCRIPTION π
The TSIOBuffer data structure is literally the building block of the TSVConn abstraction. iconic. An IO buffer is composed of a list of buffer blocks which are reference counted so that they can reside in multiple buffers at the same time. This makes it extremely efficient to copy data from one IO buffer to another using TSIOBufferCopy() since Traffic Server only needs to copy pointers and adjust reference counts appropriately and not actually copy any data. However, applications should still strive to ensure data blocks are a reasonable size. π
The IO buffer abstraction provides for a single writer and multiple readers. In order for the readers to have no knowledge of each other, they manipulate IO buffers through the TSIOBufferReader data structure. Since only a single writer is allowed, there is no corresponding TSIOBufferWriter data structure. The writer simply modifies the IO buffer directly. no cap.
TSIOBufferCreate()β creates an emptyTSIOBuffer. β¨TSIOBufferSizedCreate()β creates an emptyTSIOBufferwith an initial capacity ofindexbytes.TSIOBufferDestroy()β destroys the IO bufferbufp. Since multiple IO buffers can share data, this does not necessarily free all of the data associated with the IO buffer but simply decrements the appropriate reference counts.TSIOBufferWrite()β appendslengthbytes from the bufferbufto the IO bufferbufpand returns the number of bytes successfully written into the IO buffer.TSIOBufferProduce()β makesnbytesof data available for reading in the IO bufferbufp. A common pattern for writing to an IO buffer is to copy data into a buffer block and then callINKIOBufferProduceto make the new data visible to any readers.
π¨ NOTE π¨
The above references an old API function:INKIOBufferProduceand needs to be fixed. I don't see aTSIOBufferProducefunction that would be its obvious replacement from theInk->TSrename.
The watermark of an TSIOBuffer is the minimum number of bytes of data that have to be in the buffer before calling back any continuation that has initiated a read operation on this buffer. As a writer feeds data into the TSIOBuffer, no readers are called back until the amount of data reaches the watermark. Setting a watermark can improve performance because it avoids frequent callbacks to read small amounts of data. TSIOBufferWaterMarkGet() gets the current watermark for the IO buffer bufp.
TSIOBufferWaterMarkSet() gets the current watermark for the IO buffer bufp to water_mark bytes. (yes, the page says gets here β I'm just reporting the lore, bestie, don't come for me. π)
π SEE ALSO π
TSAPI(3ts)TSIOBufferReaderAlloc(3ts)
π COPYRIGHT π
2026, dev@trafficserver.apache.org
and that's the whole page, periodt. π this was TSIOBUFFERCREATE(3ts) from Apache Traffic Server version 9.2, dated Feb 12, 2026. go forth and buffer responsibly, queen. ππ¦
π¦ where this page comes from
- ubuntu noble: trafficserver-dev 9.2.3+ds-1+deb12u1ubuntu0.1 Β· Apache-2.0
- ubuntu questing: trafficserver-dev 9.2.5+ds-1ubuntu2.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms