Public Member Functions | Protected Types | Protected Attributes

buffered_writer< block_type > Class Template Reference
[Block scheduling sublayer]

Encapsulates asynchronous buffered block writing engine. More...

#include <buf_writer.h>

Collaboration diagram for buffered_writer< block_type >:
Collaboration graph
[legend]

List of all members.

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_ptrwrite_reqs
const unsigned_type writebatchsize
std::vector< int_type > free_write_blocks
std::vector< int_type > busy_write_blocks
batch_type batch_write_blocks

Detailed Description

template<typename block_type>
class buffered_writer< block_type >

Encapsulates asynchronous buffered block writing engine.

buffered_writer overlaps I/Os with filling of output buffer.


Constructor & Destructor Documentation

template<typename block_type >
buffered_writer< block_type >::buffered_writer ( unsigned_type  write_buf_size,
unsigned_type  write_batch_size 
) [inline]

Constructs an object.

Parameters:
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)
template<typename block_type >
virtual buffered_writer< block_type >::~buffered_writer (  )  [inline, virtual]

Flushes not yet written buffers and frees used memory.


Member Function Documentation

template<typename block_type >
void buffered_writer< block_type >::flush (  )  [inline]

Flushes not yet written buffers.

template<typename block_type >
block_type* buffered_writer< block_type >::get_free_block (  )  [inline]

Returns free block from the internal buffer pool.

Returns:
pointer to the block from the internal buffer pool

References wait_any().

Referenced by buffered_writer< block_type >::write().

template<typename block_type >
block_type* buffered_writer< block_type >::write ( block_type *  filled_block,
const bid_type &  bid 
) [inline]

Submits block for writing.

Parameters:
filled_block pointer to the block
Remarks:
parameter filled_block must be value returned by get_free_block() or write() methods
Parameters:
bid block identifier, a place to write data of the filled_block
Returns:
pointer to the new free block from the pool

References buffered_writer< block_type >::get_free_block().


The documentation for this class was generated from the following file: