Thrill  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
disk_block_allocator Class Reference

Detailed Description

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.

+ Collaboration diagram for disk_block_allocator:

#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_allocatoroperator= (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_
 
filestorage_
 

Static Private Attributes

static constexpr bool debug = false
 

Member Typedef Documentation

using place = std::pair<uint64_t, uint64_t>
private

pair (offset, size) used for free space calculation

Definition at line 124 of file disk_block_allocator.hpp.

using space_map_type = std::map<uint64_t, uint64_t>
private

Definition at line 125 of file disk_block_allocator.hpp.

Constructor & Destructor Documentation

disk_block_allocator ( file storage,
const disk_config cfg 
)
inline

non-copyable: delete copy-constructor

Member Function Documentation

void add_free_region ( uint64_t  block_pos,
uint64_t  block_size 
)
private
bool autogrow ( ) const
inline

Returns autogrow.

Definition at line 72 of file disk_block_allocator.hpp.

References disk_block_allocator::autogrow_.

void deallocation_error ( uint64_t  block_pos,
uint64_t  block_size,
const space_map_type::iterator &  pred,
const space_map_type::iterator &  succ 
) const
private
void delete_blocks ( const BIDArray< BlockSize > &  bids)
inline
void dump ( ) const
private
uint64_t free_bytes ( ) const
inline

Definition at line 79 of file disk_block_allocator.hpp.

References disk_block_allocator::free_bytes_.

bool has_available_space ( uint64_t  bytes) const
inline
void new_blocks ( BIDArray< BlockSize > &  bids)
inline
disk_block_allocator& operator= ( const disk_block_allocator )
delete

non-copyable: delete assignment operator

uint64_t total_bytes ( ) const
inline

Definition at line 89 of file disk_block_allocator.hpp.

References disk_block_allocator::disk_bytes_.

uint64_t used_bytes ( ) const
inline

Member Data Documentation

uint64_t cfg_bytes_
private
constexpr bool debug = false
staticprivate

Definition at line 47 of file disk_block_allocator.hpp.

std::mutex mutex_
private

The documentation for this class was generated from the following files: