Thrill  0.1
BoundedBlockSink Class Reference

Detailed Description

Derivative BlockSink which counts and limits how many bytes it has delivered as ByteBlocks for writing.

Definition at line 110 of file block_sink.hpp.

+ Inheritance diagram for BoundedBlockSink:
+ Collaboration diagram for BoundedBlockSink:

#include <block_sink.hpp>

Public Member Functions

 BoundedBlockSink (BlockPool &block_pool, size_t local_worker_id, size_t max_size)
 constructor with reference to BlockPool More...
 
PinnedByteBlockPtr AllocateByteBlock (size_t block_size) final
 
size_t max_size () const
 
void ReleaseByteBlock (ByteBlockPtr &block) final
 Release an unused ByteBlock with n bytes backing memory. More...
 
- Public Member Functions inherited from BlockSink
 BlockSink (BlockPool &block_pool, size_t local_worker_id)
 constructor with reference to BlockPool More...
 
 BlockSink (BlockPool *block_pool, size_t local_worker_id)
 constructor with reference to BlockPool More...
 
 BlockSink (const BlockSink &)=default
 default copy-constructor More...
 
 BlockSink (BlockSink &&)=default
 move-constructor: default More...
 
virtual ~BlockSink ()
 required virtual destructor More...
 
virtual void AppendBlock (const Block &b, bool is_last_block)=0
 Appends the (unpinned) Block. More...
 
virtual void AppendBlock (Block &&b, bool is_last_block)=0
 Appends the (unpinned) Block. More...
 
virtual void AppendPinnedBlock (PinnedBlock &&b, bool is_last_block)
 Appends the PinnedBlock. More...
 
BlockPoolblock_pool () const
 Returns block_pool_. More...
 
virtual void Close ()=0
 Closes the sink. Must not be called multiple times. More...
 
size_t local_worker_id () const
 local worker id to associate pinned block with More...
 
common::JsonLoggerlogger ()
 Returns BlockPool.logger_. More...
 
BlockSinkoperator= (const BlockSink &)=default
 default assignment operator More...
 
BlockSinkoperator= (BlockSink &&)=default
 move-assignment operator: default More...
 
size_t workers_per_host () const
 return number of workers per host More...
 

Static Public Attributes

static constexpr bool allocate_can_fail_ = true
 
- Static Public Attributes inherited from BlockSink
static constexpr bool allocate_can_fail_ = false
 

Private Attributes

size_t available_
 currently allocated ByteBlock for this BlockSink. More...
 
size_t max_size_
 maximum allocation of ByteBlock for this BlockSink More...
 

Additional Inherited Members

- Protected Attributes inherited from BlockSink
size_t local_worker_id_
 local worker id to associate pinned block with More...
 

Constructor & Destructor Documentation

◆ BoundedBlockSink()

BoundedBlockSink ( BlockPool block_pool,
size_t  local_worker_id,
size_t  max_size 
)
inline

constructor with reference to BlockPool

Definition at line 114 of file block_sink.hpp.

Member Function Documentation

◆ AllocateByteBlock()

PinnedByteBlockPtr AllocateByteBlock ( size_t  block_size)
inlinefinalvirtual

Allocate a ByteBlock with n bytes backing memory. If returned ByteBlockPtr is a nullptr, then memory of this BlockSink is exhausted.

Reimplemented from BlockSink.

Definition at line 119 of file block_sink.hpp.

References BlockSink::AllocateByteBlock().

◆ max_size()

size_t max_size ( ) const
inline

Definition at line 131 of file block_sink.hpp.

◆ ReleaseByteBlock()

void ReleaseByteBlock ( ByteBlockPtr block)
inlinefinalvirtual

Release an unused ByteBlock with n bytes backing memory.

Reimplemented from BlockSink.

Definition at line 125 of file block_sink.hpp.

Member Data Documentation

◆ allocate_can_fail_

constexpr bool allocate_can_fail_ = true
static

Definition at line 133 of file block_sink.hpp.

◆ available_

size_t available_
private

currently allocated ByteBlock for this BlockSink.

Definition at line 140 of file block_sink.hpp.

◆ max_size_

size_t max_size_
private

maximum allocation of ByteBlock for this BlockSink

Definition at line 137 of file block_sink.hpp.


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