Thrill  0.1

Detailed Description

template<typename BlockType>
class foxxll::buffered_writer< BlockType >

Encapsulates asynchronous buffered block writing engine.

buffered_writer overlaps I/Os with filling of output buffer.

Definition at line 37 of file buf_writer.hpp.

+ Inheritance diagram for buffered_writer< BlockType >:
+ Collaboration diagram for buffered_writer< BlockType >:

#include <buf_writer.hpp>

Classes

struct  batch_entry
 
struct  batch_entry_cmp
 

Public Member Functions

 buffered_writer (size_t write_buf_size, size_t write_batch_size)
 
 buffered_writer (const buffered_writer &)=delete
 non-copyable: delete copy-constructor More...
 
 ~buffered_writer ()
 Flushes not yet written buffers and frees used memory. More...
 
void flush ()
 Flushes not yet written buffers. More...
 
block_typeget_free_block ()
 
buffered_writeroperator= (const buffered_writer &)=delete
 non-copyable: delete assignment operator More...
 
block_typewrite (block_type *filled_block, const bid_type &bid)
 

Protected Types

using batch_type = std::priority_queue< batch_entry, std::vector< batch_entry >, batch_entry_cmp >
 

Protected Attributes

batch_type batch_write_blocks
 
std::vector< size_t > busy_write_blocks
 
std::vector< size_t > free_write_blocks
 
const size_t nwriteblocks
 
bid_typewrite_bids
 
block_typewrite_buffers
 
request_ptrwrite_reqs
 
const size_t writebatchsize
 

Private Types

using bid_type = typename block_type::bid_type
 
using block_type = BlockType
 

Static Private Attributes

static constexpr bool debug = false
 

Member Typedef Documentation

◆ batch_type

using batch_type = std::priority_queue<batch_entry, std::vector<batch_entry>, batch_entry_cmp>
protected

Definition at line 68 of file buf_writer.hpp.

◆ bid_type

using bid_type = typename block_type::bid_type
private

Definition at line 41 of file buf_writer.hpp.

◆ block_type

using block_type = BlockType
private

Definition at line 40 of file buf_writer.hpp.

Constructor & Destructor Documentation

◆ buffered_writer() [1/2]

buffered_writer ( size_t  write_buf_size,
size_t  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.hpp.

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

◆ buffered_writer() [2/2]

buffered_writer ( const buffered_writer< BlockType > &  )
delete

non-copyable: delete copy-constructor

◆ ~buffered_writer()

~buffered_writer ( )
inline

Flushes not yet written buffers and frees used memory.

Definition at line 194 of file buf_writer.hpp.

Member Function Documentation

◆ flush()

void flush ( )
inline

Flushes not yet written buffers.

Definition at line 164 of file buf_writer.hpp.

◆ get_free_block()

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 98 of file buf_writer.hpp.

Referenced by buf_ostream< BlockType, BidIteratorType >::buf_ostream(), and buffered_writer< block_type >::write().

◆ operator=()

buffered_writer& operator= ( const buffered_writer< BlockType > &  )
delete

non-copyable: delete assignment operator

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

◆ write()

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 137 of file buf_writer.hpp.

Referenced by buf_ostream< BlockType, BidIteratorType >::flush(), buf_ostream< BlockType, BidIteratorType >::operator++(), and buf_ostream< BlockType, BidIteratorType >::operator<<().

Member Data Documentation

◆ batch_write_blocks

batch_type batch_write_blocks
protected

Definition at line 69 of file buf_writer.hpp.

◆ busy_write_blocks

std::vector<size_t> busy_write_blocks
protected

Definition at line 51 of file buf_writer.hpp.

◆ debug

constexpr bool debug = false
staticprivate

Definition at line 39 of file buf_writer.hpp.

◆ free_write_blocks

std::vector<size_t> free_write_blocks
protected

Definition at line 50 of file buf_writer.hpp.

◆ nwriteblocks

const size_t nwriteblocks
protected

◆ write_bids

bid_type* write_bids
protected

Definition at line 46 of file buf_writer.hpp.

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

◆ write_buffers

block_type* write_buffers
protected

◆ write_reqs

request_ptr* write_reqs
protected

Definition at line 47 of file buf_writer.hpp.

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

◆ writebatchsize

const size_t writebatchsize
protected

Definition at line 48 of file buf_writer.hpp.

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


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