Thrill  0.1
BlockSink Class Referenceabstract

Detailed Description

Pure virtual base class for all things that can receive Blocks from a BlockWriter.

Definition at line 28 of file block_sink.hpp.

+ Inheritance diagram for BlockSink:
+ Collaboration diagram for BlockSink:

#include <block_sink.hpp>

Public Member Functions

 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 PinnedByteBlockPtr AllocateByteBlock (size_t block_size)
 
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...
 
virtual void ReleaseByteBlock (ByteBlockPtr &block)
 Release an unused ByteBlock with n bytes backing memory. More...
 
size_t workers_per_host () const
 return number of workers per host More...
 

Static Public Attributes

static constexpr bool allocate_can_fail_ = false
 

Protected Attributes

size_t local_worker_id_
 local worker id to associate pinned block with More...
 

Private Attributes

BlockPoolblock_pool_
 

Constructor & Destructor Documentation

◆ BlockSink() [1/4]

BlockSink ( BlockPool block_pool,
size_t  local_worker_id 
)
inlineexplicit

constructor with reference to BlockPool

Definition at line 32 of file block_sink.hpp.

Referenced by BlockSink::BlockSink().

◆ BlockSink() [2/4]

BlockSink ( BlockPool block_pool,
size_t  local_worker_id 
)
inlineexplicit

constructor with reference to BlockPool

Definition at line 37 of file block_sink.hpp.

References BlockSink::BlockSink(), and BlockSink::operator=().

◆ BlockSink() [3/4]

BlockSink ( const BlockSink )
default

default copy-constructor

◆ BlockSink() [4/4]

BlockSink ( BlockSink &&  )
default

move-constructor: default

◆ ~BlockSink()

virtual ~BlockSink ( )
inlinevirtual

required virtual destructor

Definition at line 51 of file block_sink.hpp.

Member Function Documentation

◆ AllocateByteBlock()

virtual PinnedByteBlockPtr AllocateByteBlock ( size_t  block_size)
inlinevirtual

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

Reimplemented in BoundedBlockSink.

Definition at line 56 of file block_sink.hpp.

References BlockPool::AllocateByteBlock(), BlockSink::block_pool_, and BlockSink::local_worker_id_.

Referenced by BoundedBlockSink::AllocateByteBlock().

◆ AppendBlock() [1/2]

virtual void AppendBlock ( const Block b,
bool  is_last_block 
)
pure virtual

◆ AppendBlock() [2/2]

virtual void AppendBlock ( Block &&  b,
bool  is_last_block 
)
pure virtual

◆ AppendPinnedBlock()

virtual void AppendPinnedBlock ( PinnedBlock &&  b,
bool  is_last_block 
)
inlinevirtual

Appends the PinnedBlock.

Reimplemented in WriteBinaryNode< ValueType >::SysFileSink, and StreamSink.

Definition at line 89 of file block_sink.hpp.

References BlockSink::AppendBlock().

Referenced by StreamSink::AppendPinnedBlock().

◆ block_pool()

BlockPool* block_pool ( ) const
inline

Returns block_pool_.

Definition at line 69 of file block_sink.hpp.

References BlockSink::block_pool_.

Referenced by File::Copy().

◆ Close()

virtual void Close ( )
pure virtual

Closes the sink. Must not be called multiple times.

Implemented in FileBlockSink, BlockQueueSink, WriteBinaryNode< ValueType >::SysFileSink, File, BlockQueue, StreamSink, and DiscardSink.

◆ local_worker_id()

size_t local_worker_id ( ) const
inline

local worker id to associate pinned block with

Definition at line 94 of file block_sink.hpp.

References BlockSink::local_worker_id_.

Referenced by StreamSink::AppendBlock(), WriteBinaryNode< ValueType >::SysFileSink::AppendBlock(), File::Copy(), and BlockQueue::GetBlockSource().

◆ logger()

common::JsonLogger& logger ( )
inline

◆ operator=() [1/2]

BlockSink& operator= ( const BlockSink )
default

default assignment operator

Referenced by BlockSink::BlockSink().

◆ operator=() [2/2]

BlockSink& operator= ( BlockSink &&  )
default

move-assignment operator: default

◆ ReleaseByteBlock()

virtual void ReleaseByteBlock ( ByteBlockPtr block)
inlinevirtual

Release an unused ByteBlock with n bytes backing memory.

Reimplemented in BoundedBlockSink.

Definition at line 61 of file block_sink.hpp.

References CountingPtr< Type, Deleter >::reset().

◆ workers_per_host()

size_t workers_per_host ( ) const
inline

return number of workers per host

Definition at line 72 of file block_sink.hpp.

References BlockSink::block_pool_, and BlockPool::workers_per_host().

Referenced by StreamSink::my_worker_rank(), and StreamSink::peer_worker_rank().

Member Data Documentation

◆ allocate_can_fail_

constexpr bool allocate_can_fail_ = false
static

boolean flag whether to check if AllocateByteBlock can fail in any subclass (if false: accelerate BlockWriter to not be able to cope with nullptr).

Definition at line 77 of file block_sink.hpp.

Referenced by BlockWriter< BlockSink >::Put(), and BlockWriter< BlockSink >::PutNoSelfVerify().

◆ block_pool_

BlockPool* block_pool_
private

reference to BlockPool for allocation and deallocation. (ptr to make BlockSink movable).

Definition at line 99 of file block_sink.hpp.

Referenced by BlockSink::AllocateByteBlock(), BlockSink::block_pool(), BlockSink::logger(), and BlockSink::workers_per_host().

◆ local_worker_id_


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