Thrill
0.1
|
This class manages allocation of blocks onto a single disk.
It contains a map of all currently allocated blocks. The block_manager selects which of the disk_block_allocator objects blocks are drawn from.
Definition at line 45 of file disk_block_allocator.hpp.
#include <disk_block_allocator.hpp>
Public Member Functions | |
disk_block_allocator (file *storage, const disk_config &cfg) | |
disk_block_allocator (const disk_block_allocator &)=delete | |
non-copyable: delete copy-constructor More... | |
~disk_block_allocator () | |
bool | autogrow () const |
Returns autogrow. More... | |
template<size_t BlockSize> | |
void | delete_block (const BID< BlockSize > &bid) |
template<size_t BlockSize> | |
void | delete_blocks (const BIDArray< BlockSize > &bids) |
uint64_t | free_bytes () const |
bool | has_available_space (uint64_t bytes) const |
template<size_t BlockSize> | |
void | new_blocks (BIDArray< BlockSize > &bids) |
disk_block_allocator & | operator= (const disk_block_allocator &)=delete |
non-copyable: delete assignment operator More... | |
uint64_t | total_bytes () const |
uint64_t | used_bytes () const |
template<typename BIDIterator > | |
void | new_blocks (BIDIterator begin, BIDIterator end) |
Private Types | |
using | place = std::pair< uint64_t, uint64_t > |
pair (offset, size) used for free space calculation More... | |
using | space_map_type = std::map< uint64_t, uint64_t > |
Private Member Functions | |
void | add_free_region (uint64_t block_pos, uint64_t block_size) |
void | deallocation_error (uint64_t block_pos, uint64_t block_size, const space_map_type::iterator &pred, const space_map_type::iterator &succ) const |
void | dump () const |
void | grow_file (uint64_t extend_bytes) |
Private Attributes | |
bool | autogrow_ |
uint64_t | cfg_bytes_ |
uint64_t | disk_bytes_ = 0 |
uint64_t | free_bytes_ = 0 |
space_map_type | free_space_ |
map of free space as places More... | |
std::mutex | mutex_ |
file * | storage_ |
Static Private Attributes | |
static constexpr bool | debug = false |
|
private |
pair (offset, size) used for free space calculation
Definition at line 124 of file disk_block_allocator.hpp.
|
private |
Definition at line 125 of file disk_block_allocator.hpp.
|
inline |
Definition at line 50 of file disk_block_allocator.hpp.
References disk_block_allocator::grow_file(), disk_block_allocator::operator=(), and disk_config::size.
|
delete |
non-copyable: delete copy-constructor
|
inline |
Definition at line 64 of file disk_block_allocator.hpp.
References disk_block_allocator::cfg_bytes_, disk_block_allocator::disk_bytes_, file::set_size(), and disk_block_allocator::storage_.
|
private |
Definition at line 65 of file disk_block_allocator.cpp.
References disk_block_allocator::deallocation_error(), FOXXLL_THROW2, disk_block_allocator::free_bytes_, disk_block_allocator::free_space_, and TLX_LOG.
Referenced by disk_block_allocator::delete_block(), and disk_block_allocator::grow_file().
|
inline |
Returns autogrow.
Definition at line 72 of file disk_block_allocator.hpp.
References disk_block_allocator::autogrow_.
|
private |
Definition at line 39 of file disk_block_allocator.cpp.
References disk_block_allocator::dump(), disk_block_allocator::free_space_, and TLX_LOG1.
Referenced by disk_block_allocator::add_free_region().
|
inline |
Definition at line 111 of file disk_block_allocator.hpp.
References disk_block_allocator::add_free_region(), disk_block_allocator::disk_bytes_, disk_block_allocator::free_bytes_, disk_block_allocator::mutex_, BID< Size >::offset, BID< Size >::size, and TLX_LOG0.
Referenced by disk_block_allocator::delete_blocks().
|
inline |
Definition at line 104 of file disk_block_allocator.hpp.
References disk_block_allocator::delete_block(), and SimpleVector< ValueType, Mode >::size().
|
private |
Definition at line 26 of file disk_block_allocator.cpp.
References disk_block_allocator::free_space_, and TLX_LOG1.
Referenced by disk_block_allocator::deallocation_error(), and disk_block_allocator::new_blocks().
|
inline |
Definition at line 79 of file disk_block_allocator.hpp.
References disk_block_allocator::free_bytes_.
|
inlineprivate |
Definition at line 147 of file disk_block_allocator.hpp.
References disk_block_allocator::add_free_region(), and file::set_size().
Referenced by disk_block_allocator::disk_block_allocator(), and disk_block_allocator::new_blocks().
|
inline |
Definition at line 74 of file disk_block_allocator.hpp.
References disk_block_allocator::autogrow_, bytes, and disk_block_allocator::free_bytes_.
|
inline |
Definition at line 95 of file disk_block_allocator.hpp.
References SimpleVector< ValueType, Mode >::begin(), and SimpleVector< ValueType, Mode >::end().
Referenced by disk_block_allocator::new_blocks().
void new_blocks | ( | BIDIterator | begin, |
BIDIterator | end | ||
) |
Definition at line 159 of file disk_block_allocator.hpp.
References disk_block_allocator::autogrow_, disk_block_allocator::disk_bytes_, disk_block_allocator::dump(), FOXXLL_THROW, disk_block_allocator::free_bytes_, disk_block_allocator::free_space_, disk_block_allocator::grow_file(), disk_block_allocator::mutex_, disk_block_allocator::new_blocks(), TLX_LOG, and TLX_LOG1.
|
delete |
non-copyable: delete assignment operator
Referenced by disk_block_allocator::disk_block_allocator().
|
inline |
Definition at line 89 of file disk_block_allocator.hpp.
References disk_block_allocator::disk_bytes_.
|
inline |
Definition at line 84 of file disk_block_allocator.hpp.
References disk_block_allocator::disk_bytes_, and disk_block_allocator::free_bytes_.
|
private |
Definition at line 134 of file disk_block_allocator.hpp.
Referenced by disk_block_allocator::autogrow(), disk_block_allocator::has_available_space(), and disk_block_allocator::new_blocks().
|
private |
Definition at line 132 of file disk_block_allocator.hpp.
Referenced by disk_block_allocator::~disk_block_allocator().
|
staticprivate |
Definition at line 47 of file disk_block_allocator.hpp.
|
private |
Definition at line 131 of file disk_block_allocator.hpp.
Referenced by disk_block_allocator::delete_block(), disk_block_allocator::new_blocks(), disk_block_allocator::total_bytes(), disk_block_allocator::used_bytes(), and disk_block_allocator::~disk_block_allocator().
|
private |
Definition at line 130 of file disk_block_allocator.hpp.
Referenced by disk_block_allocator::add_free_region(), disk_block_allocator::delete_block(), disk_block_allocator::free_bytes(), disk_block_allocator::has_available_space(), disk_block_allocator::new_blocks(), and disk_block_allocator::used_bytes().
|
private |
map of free space as places
Definition at line 129 of file disk_block_allocator.hpp.
Referenced by disk_block_allocator::add_free_region(), disk_block_allocator::deallocation_error(), disk_block_allocator::dump(), and disk_block_allocator::new_blocks().
|
private |
Definition at line 127 of file disk_block_allocator.hpp.
Referenced by disk_block_allocator::delete_block(), and disk_block_allocator::new_blocks().
|
private |
Definition at line 133 of file disk_block_allocator.hpp.
Referenced by disk_block_allocator::~disk_block_allocator().