Pool of shared buffers. More...
#include <tpie/compressed/buffer.h>
Public Types | |
typedef std::shared_ptr < compressor_buffer > | buffer_t |
Public Member Functions | |
buffer_t | allocate_own_buffer () |
void | release_own_buffer (buffer_t &) |
bool | can_take_shared_buffer () |
buffer_t | take_shared_buffer () |
void | release_shared_buffer (buffer_t &) |
Pool of shared buffers.
Streams need block buffers to store data read from disk and data to be written to disk.
Each stream owns a number of buffers which it may allocate after open() and must deallocate on close(). Currently, each stream has just one own buffer.
In addition, on program startup we allocate a number of shared buffers on program startup which any stream may use for additional efficiency. Currently, we allocate two such shared buffers.
The stream_buffer_pool class is responsible for allocating and deallocating both the streams' own buffers and the shared buffers.
The stream_buffers class is responsible for making sure it only requests as many own buffers as a stream is allowed to.