IO バッファー

The IO buffer data structure is the building block of the vconnection abstraction. An IO buffer (TSIOBuffer) is composed of a list of buffer blocks that point to buffer data. Both the buffer block (TSIOBufferBlock) and buffer data (TSIOBufferData) data structures are reference-counted, so they can reside in multiple buffers at the same time. This makes it extremely efficient to copy data from one IO buffer to another via TSIOBufferCopy(), since Traffic Server must only copy pointers and adjust reference counts appropriately (and doesn't actually copy any data).

IO バッファー抽象構造は一つの writer と複数の reader を提供します。reader がお互いを知る必要を無くすため、 TSIOBufferReader データ構造を通して IO バッファーを操作します。 writer は一つのみしか許可されていないため、TSIOBufferWriter データ構造に相当するものはありません。 writer は単純に IO バッファーを直接修正します。 IO バッファーの使用方法を図示した例を確認するには TSIOBufferBlockReadStart() の記述のサンプルコードを参照してください。

IO バッファー関数に関する追加情報

  • TSIOBufferReader データ構造は TSIOBuffer に幾つのデータが読み込まれたかを追跡します。これは特定のバッファー reader の現在の開始地点のオフセットバイト数を持ちます。( TSIOBuffer の読込み操作ごとに、 TSIOBufferReader を割り当てる必要があります。)

  • Bytes that have already been read may not necessarily be freed within the TSIOBuffer. To consume bytes that have been read, you must call TSIOBufferReaderConsume().