13 #ifndef FOXXLL_MNG_READ_WRITE_POOL_HEADER 14 #define FOXXLL_MNG_READ_WRITE_POOL_HEADER 30 template <
typename BlockType>
35 using bid_type =
typename block_type::bid_type;
64 std::swap(w_pool, obj.
w_pool);
65 std::swap(p_pool, obj.
p_pool);
113 p_pool->
hint(bid, *w_pool);
122 return w_pool->
steal();
142 return p_pool->
hint(bid, *w_pool);
165 return p_pool->
read(block, bid, *w_pool);
172 return p_pool->
find(bid);
178 return p_pool->
poll(bid);
192 return p_pool->
steal();
220 template <
class BlockType>
229 #endif // !FOXXLL_MNG_READ_WRITE_POOL_HEADER Implements dynamically resizable prefetching pool.
~read_write_pool()
Waits for completion of all ongoing requests and frees memory.
bool invalidate(bid_type bid)
Cancel a hint request in case the block is no longer desired.
request_ptr read(block_type *&block, bid_type bid)
Reads block.
size_t size() const
Returns number of owned blocks.
request_ptr read(block_type *&block, bid_type bid)
Reads block.
request_ptr find(bid_type bid)
Implements dynamically resizable buffered writing pool.
void resize(size_t new_size)
bool invalidate(bid_type bid)
Cancel a hint request in case the block is no longer desired.
void add(block_type *&block)
Add a new block to prefetch pool, enlarges size of pool.
void resize_prefetch(size_type new_size)
Implements dynamically resizable buffered writing and prefetched reading pool.
request_ptr write(block_type *&block, bid_type bid)
void add_prefetch(block_type *&block)
Add block to prefetch pool.
block_type * steal_prefetch()
prefetch_pool_type * p_pool
void resize_write(size_type new_size)
read_write_pool(size_type init_size_prefetch=1, size_type init_size_write=1)
size_t resize(size_t new_size)
read_write_pool & operator=(const read_write_pool &)=delete
non-copyable: delete assignment operator
write_pool< block_type > write_pool_type
bool in_prefetching(bid_type bid)
Checks if a block is in the hinted block set.
size_type size_write() const
Returns number of blocks owned by the write_pool.
size_t busy_size() const
Returns the number of busy prefetching blocks.
High-performance smart pointer used as a wrapping reference counting pointer.
size_t free_size_prefetch() const
Returns the number of free prefetching blocks.
size_t busy_size_prefetch() const
Returns the number of busy prefetching blocks.
prefetch_pool< block_type > prefetch_pool_type
size_type size_prefetch() const
Returns number of blocks owned by the prefetch_pool.
void swap(read_write_pool &obj)
void add(block_type *&block)
bool poll(bid_type bid)
Returns true if the blocks was hinted and the request is finished.
typename block_type::bid_type bid_type
size_t size() const
Returns number of owned blocks.
bool poll_hint(bid_type bid)
Returns true if the blocks was hinted and the request is finished.
size_t free_size() const
Returns the number of free prefetching blocks.
bool in_prefetching(bid_type bid)
Checks if a block is in the hinted block set.
void add(block_type *&block)
Add block to write pool.
request_ptr write(block_type *&block, bid_type bid)
bool hint(bid_type bid)
Gives a hint for prefetching a block, the block may or may not be read into a prefetch buffer...
request_ptr find_hint(bid_type bid)