Thrill
0.1
|
Block manager class.
Manages allocation and deallocation of blocks in multiple/single disk setting
Definition at line 54 of file block_manager.hpp.
#include <block_manager.hpp>
Public Member Functions | |
~block_manager () | |
template<size_t BlockSize> | |
void | delete_block (const BID< BlockSize > &bid) |
template<typename BIDIterator > | |
void | delete_blocks (const BIDIterator &bid_begin, const BIDIterator &bid_end) |
template<typename DiskAssignFunctor , size_t BlockSize> | |
void | new_block (const DiskAssignFunctor &functor, BID< BlockSize > &bid, size_t alloc_offset=0) |
Allocates a new block according to the strategy given by functor and stores the block identifier to bid. More... | |
template<typename DiskAssignFunctor , typename BIDIterator > | |
void | new_blocks (const DiskAssignFunctor &functor, BIDIterator bid_begin, BIDIterator bid_end, size_t alloc_offset=0) |
Allocates new blocks. More... | |
Statistics | |
uint64_t | total_bytes () const |
return total number of bytes available in all disks More... | |
uint64_t | free_bytes () const |
Return total number of free bytes. More... | |
uint64_t | total_allocation () const |
return total requested allocation in bytes More... | |
uint64_t | current_allocation () const |
return currently allocated bytes More... | |
uint64_t | maximum_allocation () const |
return maximum number of bytes allocated during program run. More... | |
Public Member Functions inherited from singleton< block_manager > | |
singleton ()=default | |
singleton (const singleton &)=delete | |
non-copyable: delete copy-constructor More... | |
singleton & | operator= (const singleton &)=delete |
non-copyable: delete assignment operator More... | |
Private Member Functions | |
block_manager () | |
private construction from singleton More... | |
Private Attributes | |
tlx::simple_vector< disk_block_allocator * > | block_allocators_ |
one block allocator per disk More... | |
uint64_t | current_allocation_ = 0 |
currently allocated bytes More... | |
tlx::simple_vector< file_ptr > | disk_files_ |
vector of opened disk files More... | |
uint64_t | maximum_allocation_ = 0 |
maximum number of bytes allocated during program run. More... | |
std::mutex | mutex_ |
protect internal data structures More... | |
size_t | ndisks_ |
number of managed disks More... | |
uint64_t | total_allocation_ = 0 |
total requested allocation in bytes More... | |
Static Private Attributes | |
static constexpr bool | debug = false |
static constexpr bool | verbose_block_life_cycle = false |
log creation and destruction of blocks More... | |
Additional Inherited Members | |
Public Types inherited from singleton< block_manager > | |
using | instance_pointer = instance_type * |
using | instance_type = block_manager |
using | volatile_instance_pointer = volatile instance_pointer |
Static Public Member Functions inherited from singleton< block_manager > | |
static instance_pointer | create_instance () |
create instance of SubInstanceType and move into singleton More... | |
static void | destroy_instance () |
destroy singleton and mark as invalid More... | |
static instance_pointer | get_instance () |
return instance or create base instance if empty More... | |
static instance_type & | get_ref () |
~block_manager | ( | ) |
Definition at line 86 of file block_manager.cpp.
References block_manager::block_allocators_, block_manager::disk_files_, block_manager::ndisks_, and TLX_LOG.
Referenced by block_manager::new_block().
|
private |
private construction from singleton
Definition at line 33 of file block_manager.cpp.
References block_manager::block_allocators_, config::check_initialized(), file::CREAT, foxxll::create_file(), file::DEFAULT_QUEUE, config::disk(), block_manager::disk_files_, config::disks_number(), disk_config::fileio_string(), singleton< config >::get_instance(), singleton< disk_queues >::get_instance(), block_manager::ndisks_, disk_config::path, disk_config::queue, file::RDWR, disk_config::size, and TLX_LOG1.
uint64_t current_allocation | ( | ) | const |
return currently allocated bytes
Definition at line 127 of file block_manager.cpp.
References block_manager::current_allocation_, and block_manager::mutex_.
Referenced by block_manager::new_block().
uint64_t free_bytes | ( | ) | const |
Return total number of free bytes.
Definition at line 109 of file block_manager.cpp.
References block_manager::block_allocators_, block_manager::mutex_, and block_manager::ndisks_.
Referenced by block_manager::new_block().
uint64_t maximum_allocation | ( | ) | const |
return maximum number of bytes allocated during program run.
Definition at line 133 of file block_manager.cpp.
References block_manager::maximum_allocation_, and block_manager::mutex_.
Referenced by Context::Launch(), and block_manager::new_block().
|
inline |
Allocates a new block according to the strategy given by functor and stores the block identifier to bid.
Allocation will be lined up with previous partial allocations of alloc_offset blocks.
functor | object of model of allocation_strategy concept |
bid | BID to store the block identifier |
alloc_offset | advance for functor to line up partial allocations |
Definition at line 91 of file block_manager.hpp.
References block_manager::current_allocation(), block_manager::delete_block(), block_manager::delete_blocks(), block_manager::free_bytes(), block_manager::maximum_allocation(), block_manager::new_blocks(), block_manager::total_allocation(), block_manager::total_bytes(), and block_manager::~block_manager().
Referenced by swappable_block< ValueType, BlockSize >::get_external_block().
uint64_t total_allocation | ( | ) | const |
return total requested allocation in bytes
Definition at line 121 of file block_manager.cpp.
References block_manager::mutex_, and block_manager::total_allocation_.
Referenced by block_manager::new_block().
uint64_t total_bytes | ( | ) | const |
return total number of bytes available in all disks
Definition at line 97 of file block_manager.cpp.
References block_manager::block_allocators_, block_manager::mutex_, and block_manager::ndisks_.
Referenced by block_manager::new_block().
|
private |
one block allocator per disk
Definition at line 143 of file block_manager.hpp.
Referenced by block_manager::block_manager(), block_manager::delete_block(), block_manager::free_bytes(), block_manager::new_blocks(), block_manager::total_bytes(), and block_manager::~block_manager().
|
private |
currently allocated bytes
Definition at line 149 of file block_manager.hpp.
Referenced by block_manager::current_allocation(), block_manager::delete_block(), and block_manager::new_blocks().
|
staticprivate |
Definition at line 56 of file block_manager.hpp.
|
private |
vector of opened disk files
Definition at line 140 of file block_manager.hpp.
Referenced by block_manager::block_manager(), block_manager::delete_block(), block_manager::new_blocks(), and block_manager::~block_manager().
|
private |
maximum number of bytes allocated during program run.
Definition at line 152 of file block_manager.hpp.
Referenced by block_manager::maximum_allocation(), and block_manager::new_blocks().
|
mutableprivate |
protect internal data structures
Definition at line 158 of file block_manager.hpp.
Referenced by block_manager::current_allocation(), block_manager::delete_block(), block_manager::free_bytes(), block_manager::maximum_allocation(), block_manager::new_blocks(), block_manager::total_allocation(), and block_manager::total_bytes().
|
private |
number of managed disks
Definition at line 137 of file block_manager.hpp.
Referenced by block_manager::block_manager(), block_manager::free_bytes(), block_manager::new_blocks(), block_manager::total_bytes(), and block_manager::~block_manager().
|
private |
total requested allocation in bytes
Definition at line 146 of file block_manager.hpp.
Referenced by block_manager::new_blocks(), and block_manager::total_allocation().
|
staticprivate |
log creation and destruction of blocks
Definition at line 161 of file block_manager.hpp.
Referenced by block_manager::delete_block(), and block_manager::new_blocks().