12 #ifndef THRILL_DATA_BLOCK_SINK_HEADER 13 #define THRILL_DATA_BLOCK_SINK_HEADER 80 virtual void Close() = 0;
90 return AppendBlock(std::move(b).MoveToBlock(), is_last_block);
115 :
BlockSink(block_pool, local_worker_id),
116 max_size_(max_size), available_(max_size)
121 available_ -= block_size;
127 available_ += block->size();
148 #endif // !THRILL_DATA_BLOCK_SINK_HEADER Block combines a reference to a read-only ByteBlock and book-keeping information. ...
PinnedByteBlockPtr AllocateByteBlock(size_t block_size) final
virtual void AppendPinnedBlock(PinnedBlock &&b, bool is_last_block)
Appends the PinnedBlock.
virtual void ReleaseByteBlock(ByteBlockPtr &block)
Release an unused ByteBlock with n bytes backing memory.
virtual ~BlockSink()
required virtual destructor
Derivative BlockSink which counts and limits how many bytes it has delivered as ByteBlocks for writin...
A pinned / pin-counted pointer to a ByteBlock.
void reset()
release contained pointer, frees object if this is the last reference.
A non-pinned counting pointer to a ByteBlock.
virtual void AppendBlock(const Block &b, bool is_last_block)=0
Appends the (unpinned) Block.
BlockSink(BlockPool *block_pool, size_t local_worker_id)
constructor with reference to BlockPool
PinnedByteBlockPtr AllocateByteBlock(size_t size, size_t local_worker_id)
size_t local_worker_id_
local worker id to associate pinned block with
size_t available_
currently allocated ByteBlock for this BlockSink.
Pool to allocate, keep, swap out/in, and free all ByteBlocks on the host.
size_t workers_per_host() const
return number of workers per host
size_t max_size_
maximum allocation of ByteBlock for this BlockSink
BlockSink & operator=(const BlockSink &)=default
default assignment operator
size_t local_worker_id() const
local worker id to associate pinned block with
BlockPool * block_pool() const
Returns block_pool_.
BoundedBlockSink(BlockPool &block_pool, size_t local_worker_id, size_t max_size)
constructor with reference to BlockPool
common::JsonLogger & logger()
Returns logger_.
Pure virtual base class for all things that can receive Blocks from a BlockWriter.
A pinned / pin-counted derivative of a Block.
static constexpr bool allocate_can_fail_
JsonLogger is a receiver of JSON output objects for logging.
virtual void Close()=0
Closes the sink. Must not be called multiple times.
void ReleaseByteBlock(ByteBlockPtr &block) final
Release an unused ByteBlock with n bytes backing memory.
size_t workers_per_host() const
return number of workers per host
virtual PinnedByteBlockPtr AllocateByteBlock(size_t block_size)
common::JsonLogger & logger()
Returns BlockPool.logger_.
BlockSink(BlockPool &block_pool, size_t local_worker_id)
constructor with reference to BlockPool