30 : data_(data), size_(size),
31 block_pool_(block_pool),
32 pin_count_(block_pool_->workers_per_host())
37 int64_t offset,
size_t size)
46 sLOG <<
"ByteBlock[" << bb <<
"]::deleter()" 55 sLOG <<
"ByteBlock[ " << bb <<
"]::destroy()";
60 return operator () (const_cast<ByteBlock*>(bb));
80 os <<
"[ByteBlock" <<
" " << &b
81 <<
" data_=" <<
static_cast<const void*
>(b.
data_)
82 <<
" size_=" << b.
size_ #define sLOG
Default logging method: output if the local debug variable is true.
std::vector< size_t, mem::GPoolAllocator< size_t > > pin_count_
counts the number of pins in this block per thread_id.
size_t size() const
the block size
void OnWriteComplete(foxxll::request *req, bool success)
forwarded to block_pool_
friend std::ostream & operator<<(std::ostream &os, const ByteBlock &b)
void OnWriteComplete(ByteBlock *block_ptr, foxxll::request *req, bool success)
callback for async write of blocks during eviction
size_t default_block_size
default size of blocks in File, Channel, BlockQueue, etc.
void DecBlockPinCount(ByteBlock *block_ptr, size_t local_worker_id)
Decrement a ByteBlock's pin count and possibly unpin it.
BlockPool * block_pool_
reference to BlockPool for deletion.
void IncPinCount(size_t local_worker_id)
increment pin count, must be >= 1 before.
static ssize_t get(const CounterType &a)
void DestroyBlock(ByteBlock *block_ptr)
Destroys the block. Called by ByteBlockPtr's deleter.
void IncBlockPinCount(ByteBlock *block_ptr, size_t local_worker_id)
Increment a ByteBlock's pin count, requires the pin count to be > 0.
std::string pin_count_str() const
return string list of pin_counts
void operator()(ByteBlock *bb) const
ByteBlock()=delete
No default construction of Byteblock.
void destroy(Type *t)
Destroy and deallocate a single item of given Type.
foxxll::file_ptr ext_file_
size_t start_block_size
starting size of blocks in BlockWriter.
const size_t size_
the allocated size of the buffer in bytes
Pool & GPool()
singleton instance of global pool for I/O data structures
uint8_t Byte
type of underlying memory area
Pool to allocate, keep, swap out/in, and free all ByteBlocks on the host.
A ByteBlock is the basic storage units of containers like File, BlockQueue, etc.
size_t reference_count() const noexcept
Return the number of references to this object (for debugging)
std::basic_string< char, std::char_traits< char >, Allocator< char > > string
string with Manager tracking
High-performance smart pointer used as a wrapping reference counting pointer.
static size_t default_prefetch_size_
Request object encapsulating basic properties like file and offset.
std::string join(char glue, const std::vector< std::string > &parts)
Join a vector of strings by some glue character between each pair from the sequence.
void DecPinCount(size_t local_worker_id)
decrement pin count, possibly signal block pool that if it reaches zero.