23 os <<
"[Block " << std::hex << &b << std::dec
26 os <<
" begin_=" << b.
begin_ 36 return Pin(local_worker_id)->Wait();
41 return byte_block()->block_pool_->PinBlock(*
this, local_worker_id);
50 reinterpret_cast<const char*>(data_begin()),
size());
55 <<
" block_=" <<
static_cast<const Block&
>(b);
57 os <<
" pin_count_=" << b.
byte_block_->pin_count_str();
65 if (ready_)
return block_;
67 std::unique_lock<std::mutex> lock(block_pool_->mutex_);
68 while (!ready_.load())
69 block_pool_->cv_read_complete_.wait(lock);
PinnedBlock PinWait(size_t local_worker_id) const
Convenience function to call Pin() and wait for the future.
Block combines a reference to a read-only ByteBlock and book-keeping information. ...
PinnedBlock Wait()
wait and get the PinnedBlock. this may block until the read is complete.
size_t size() const
return length of valid data in bytes.
Type * get() const noexcept
return the enclosed pointer.
std::basic_string< char, std::char_traits< char >, Allocator< char > > string
string with Manager tracking
ByteBlockPtr byte_block_
referenced ByteBlock
PinRequestPtr Pin(size_t local_worker_id) const
High-performance smart pointer used as a wrapping reference counting pointer.
A pinned / pin-counted derivative of a Block.
size_t begin_
beginning offset of valid bytes to read
friend std::ostream & operator<<(std::ostream &os, const Block &b)
bool IsValid() const
Return whether the enclosed ByteBlock is valid.
std::ostream & operator<<(std::ostream &os, const Block &b)
const ByteBlockPtr & byte_block() const
access to byte_block_
std::string ToString() const