Stxxl  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Classes | Public Member Functions | Protected Types | Protected Attributes | Private Member Functions
stxxl::buffered_writer< block_type > Class Template Reference

Encapsulates asynchronous buffered block writing engine. More...

#include <buf_writer.h>

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

List of all members.

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_typeget_free_block ()
 Returns free block from the internal buffer pool.
block_typewrite (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_typewrite_buffers
bid_typewrite_bids
request_ptrwrite_reqs
const unsigned_type writebatchsize
std::vector< int_typefree_write_blocks
std::vector< int_typebusy_write_blocks
batch_type batch_write_blocks

Private Member Functions

 buffered_writer ()

Detailed Description

template<typename block_type>
class stxxl::buffered_writer< block_type >

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.


Member Typedef Documentation

template<typename block_type >
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.

template<typename block_type >
typedef block_type::bid_type stxxl::buffered_writer< block_type >::bid_type [protected]

Definition at line 42 of file buf_writer.h.


Constructor & Destructor Documentation

template<typename block_type >
stxxl::buffered_writer< block_type >::buffered_writer ( ) [inline, private]

Definition at line 39 of file buf_writer.h.

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

Constructs an object.

Parameters:
write_buf_sizenumber of write buffers to use
write_batch_sizenumber of blocks to accumulate in order to flush write requests (bulk buffered writing)

Definition at line 76 of file buf_writer.h.

template<typename block_type >
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().


Member Function Documentation

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

Flushes not yet written buffers.

Definition at line 158 of file buf_writer.h.

template<typename block_type >
block_type* stxxl::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

Definition at line 91 of file buf_writer.h.

References stxxl::BID< SIZE >::size, UNLIKELY, and stxxl::wait_any().

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

Submits block for writing.

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

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().


Member Data Documentation

template<typename block_type >
batch_type stxxl::buffered_writer< block_type >::batch_write_blocks [protected]

Definition at line 69 of file buf_writer.h.

template<typename block_type >
std::vector<int_type> stxxl::buffered_writer< block_type >::busy_write_blocks [protected]

Definition at line 51 of file buf_writer.h.

template<typename block_type >
std::vector<int_type> stxxl::buffered_writer< block_type >::free_write_blocks [protected]

Definition at line 50 of file buf_writer.h.

template<typename block_type >
const unsigned_type stxxl::buffered_writer< block_type >::nwriteblocks [protected]

Definition at line 44 of file buf_writer.h.

template<typename block_type >
bid_type* stxxl::buffered_writer< block_type >::write_bids [protected]

Definition at line 46 of file buf_writer.h.

template<typename block_type >
block_type* stxxl::buffered_writer< block_type >::write_buffers [protected]

Definition at line 45 of file buf_writer.h.

template<typename block_type >
request_ptr* stxxl::buffered_writer< block_type >::write_reqs [protected]

Definition at line 47 of file buf_writer.h.

template<typename block_type >
const unsigned_type stxxl::buffered_writer< block_type >::writebatchsize [protected]

Definition at line 48 of file buf_writer.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines