Stxxl
1.4.0
|
Encapsulates asynchronous buffered block writing engine. More...
#include <buf_writer.h>
Classes | |
struct | batch_entry |
struct | batch_entry_cmp |
Public Member Functions | |
buffered_writer (unsigned_type write_buf_size, unsigned_type write_batch_size) | |
Constructs an object. | |
block_type * | get_free_block () |
Returns free block from the internal buffer pool. | |
block_type * | write (block_type *filled_block, const bid_type &bid) |
Submits block for writing. | |
void | flush () |
Flushes not yet written buffers. | |
virtual | ~buffered_writer () |
Flushes not yet written buffers and frees used memory. | |
Protected Types | |
typedef block_type::bid_type | bid_type |
typedef std::priority_queue < batch_entry, std::vector < batch_entry > , batch_entry_cmp > | batch_type |
Protected Attributes | |
const unsigned_type | nwriteblocks |
block_type * | write_buffers |
bid_type * | write_bids |
request_ptr * | write_reqs |
const unsigned_type | writebatchsize |
std::vector< int_type > | free_write_blocks |
std::vector< int_type > | busy_write_blocks |
batch_type | batch_write_blocks |
Private Member Functions | |
buffered_writer () |
Encapsulates asynchronous buffered block writing engine.
buffered_writer
overlaps I/Os with filling of output buffer.
Definition at line 37 of file buf_writer.h.
typedef std::priority_queue<batch_entry, std::vector<batch_entry>, batch_entry_cmp> stxxl::buffered_writer< block_type >::batch_type [protected] |
Definition at line 68 of file buf_writer.h.
typedef block_type::bid_type stxxl::buffered_writer< block_type >::bid_type [protected] |
Definition at line 42 of file buf_writer.h.
stxxl::buffered_writer< block_type >::buffered_writer | ( | ) | [inline, private] |
Definition at line 39 of file buf_writer.h.
stxxl::buffered_writer< block_type >::buffered_writer | ( | unsigned_type | write_buf_size, |
unsigned_type | write_batch_size | ||
) | [inline] |
Constructs an object.
write_buf_size | number of write buffers to use |
write_batch_size | number of blocks to accumulate in order to flush write requests (bulk buffered writing) |
Definition at line 76 of file buf_writer.h.
virtual stxxl::buffered_writer< block_type >::~buffered_writer | ( | ) | [inline, virtual] |
Flushes not yet written buffers and frees used memory.
Definition at line 190 of file buf_writer.h.
References stxxl::buffered_writer< block_type >::write().
void stxxl::buffered_writer< block_type >::flush | ( | ) | [inline] |
Flushes not yet written buffers.
Definition at line 158 of file buf_writer.h.
block_type* stxxl::buffered_writer< block_type >::get_free_block | ( | ) | [inline] |
Returns free block from the internal buffer pool.
Definition at line 91 of file buf_writer.h.
References stxxl::BID< SIZE >::size, UNLIKELY, and stxxl::wait_any().
block_type* stxxl::buffered_writer< block_type >::write | ( | block_type * | filled_block, |
const bid_type & | bid | ||
) | [inline] |
Submits block for writing.
filled_block | pointer to the block |
filled_block
must be value returned by get_free_block()
or write()
methods bid | block identifier, a place to write data of the filled_block |
Definition at line 131 of file buf_writer.h.
References stxxl::BID< SIZE >::offset, and stxxl::request_interface::wait().
Referenced by stxxl::buffered_writer< block_type >::~buffered_writer().
batch_type stxxl::buffered_writer< block_type >::batch_write_blocks [protected] |
Definition at line 69 of file buf_writer.h.
std::vector<int_type> stxxl::buffered_writer< block_type >::busy_write_blocks [protected] |
Definition at line 51 of file buf_writer.h.
std::vector<int_type> stxxl::buffered_writer< block_type >::free_write_blocks [protected] |
Definition at line 50 of file buf_writer.h.
const unsigned_type stxxl::buffered_writer< block_type >::nwriteblocks [protected] |
Definition at line 44 of file buf_writer.h.
bid_type* stxxl::buffered_writer< block_type >::write_bids [protected] |
Definition at line 46 of file buf_writer.h.
block_type* stxxl::buffered_writer< block_type >::write_buffers [protected] |
Definition at line 45 of file buf_writer.h.
request_ptr* stxxl::buffered_writer< block_type >::write_reqs [protected] |
Definition at line 47 of file buf_writer.h.
const unsigned_type stxxl::buffered_writer< block_type >::writebatchsize [protected] |
Definition at line 48 of file buf_writer.h.