Thrill
0.1
|
Pure virtual base class for all things that can receive Blocks from a BlockWriter.
Definition at line 28 of file block_sink.hpp.
#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... | |
BlockPool * | block_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::JsonLogger & | logger () |
Returns BlockPool.logger_. More... | |
BlockSink & | operator= (const BlockSink &)=default |
default assignment operator More... | |
BlockSink & | operator= (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 | |
BlockPool * | block_pool_ |
constructor with reference to BlockPool
Definition at line 32 of file block_sink.hpp.
Referenced by BlockSink::BlockSink().
constructor with reference to BlockPool
Definition at line 37 of file block_sink.hpp.
References BlockSink::BlockSink(), and BlockSink::operator=().
|
inlinevirtual |
required virtual destructor
Definition at line 51 of file block_sink.hpp.
|
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().
|
pure virtual |
Appends the (unpinned) Block.
Implemented in FileBlockSink, BlockQueueSink, WriteBinaryNode< ValueType >::SysFileSink, File, StreamSink, BlockQueue, and DiscardSink.
Referenced by BlockSink::AppendPinnedBlock().
|
pure virtual |
Appends the (unpinned) Block.
Implemented in FileBlockSink, BlockQueueSink, WriteBinaryNode< ValueType >::SysFileSink, File, BlockQueue, StreamSink, and DiscardSink.
|
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().
|
inline |
Returns block_pool_.
Definition at line 69 of file block_sink.hpp.
References BlockSink::block_pool_.
Referenced by File::Copy().
|
pure virtual |
Closes the sink. Must not be called multiple times.
Implemented in FileBlockSink, BlockQueueSink, WriteBinaryNode< ValueType >::SysFileSink, File, BlockQueue, StreamSink, and DiscardSink.
|
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().
|
inline |
Returns BlockPool.logger_.
Definition at line 66 of file block_sink.hpp.
References BlockSink::block_pool_, and BlockPool::logger().
Referenced by StreamSink::Finalize(), StreamSink::StreamSink(), and File::~File().
default assignment operator
Referenced by BlockSink::BlockSink().
|
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().
|
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().
|
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().
|
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().
|
protected |
local worker id to associate pinned block with
Definition at line 103 of file block_sink.hpp.
Referenced by BlockSink::AllocateByteBlock(), StreamSink::AppendBlock(), StreamSink::AppendPinnedBlock(), File::GetConsumeReader(), File::GetKeepReader(), File::GetReader(), File::GetReaderAt(), BlockSink::local_worker_id(), and StreamSink::my_worker_rank().