|
Thrill
0.1
|
Access point to disks properties. Since 1.4.0: no config files are read automatically!
Definition at line 114 of file config.hpp.
Inheritance diagram for config:
Collaboration diagram for config:#include <config.hpp>
Public Member Functions | |
Initialization Functions | |
| void | check_initialized () |
| virtual void | load_config_file (const std::string &config_path) |
| Load disk configuration file. More... | |
| virtual void | load_default_config () |
| Load default configuration. More... | |
| config & | add_disk (const disk_config &cfg) |
Query Functions | |
| size_t | disks_number () |
| std::pair< unsigned, unsigned > | regular_disk_range () const |
| Returns contiguous range of regular disks w/o flash devices in the array of all disks. More... | |
| std::pair< unsigned, unsigned > | flash_range () const |
| disk_config & | disk (size_t disk) |
| Returns mutable disk_config structure for additional disk parameters. More... | |
| const disk_config & | disk (size_t disk) const |
| Returns constant disk_config structure for additional disk parameters. More... | |
| const std::string & | disk_path (size_t disk) const |
| virtual std::string | default_disk_path () |
| virtual std::string | default_disk_io_impl () |
| Returns name of the default I/O implementation. More... | |
| virtual std::string | default_config_file_name () |
| returns the name of the default config file prefix More... | |
| external_size_type | disk_size (size_t disk) const |
| const std::string & | disk_io_impl (size_t disk) const |
| external_size_type | total_size () const |
| Returns the total size over all disks. More... | |
Public Member Functions inherited from singleton< config > | |
| singleton ()=default | |
| singleton (const singleton &)=delete | |
| non-copyable: delete copy-constructor More... | |
| singleton & | operator= (const singleton &)=delete |
| non-copyable: delete assignment operator More... | |
Protected Member Functions | |
| config () | |
| Constructor: this must be inlined to print the header version string. More... | |
| virtual | ~config () |
| deletes autogrow files More... | |
| virtual void | find_config () |
| Search several places for a config file. More... | |
| virtual void | initialize () |
Private Types | |
| using | disk_list_type = std::vector< disk_config > |
| typedef of list of configured disks More... | |
Private Attributes | |
| disk_list_type | disks_list |
| list of configured disks More... | |
| unsigned | first_flash |
| In disks_list, flash devices come after all regular disks. More... | |
| bool | is_initialized |
| Finished initializing config. More... | |
Automatic Disk Enumeration Functions | |
| unsigned int | max_device_id_ |
| static counter for automatic physical device enumeration More... | |
| unsigned int | max_device_id () |
| Returns automatic physical device id counter. More... | |
| unsigned int | next_device_id () |
| Returns next automatic physical device id counter. More... | |
| void | update_max_device_id (unsigned int devid) |
| Update the automatic physical device id counter. More... | |
Additional Inherited Members | |
Public Types inherited from singleton< config > | |
| using | instance_pointer = instance_type * |
| using | instance_type = config |
| using | volatile_instance_pointer = volatile instance_pointer |
Static Public Member Functions inherited from singleton< config > | |
| 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 () |
|
private |
typedef of list of configured disks
Definition at line 119 of file config.hpp.
|
protected |
Constructor: this must be inlined to print the header version string.
Definition at line 49 of file config.cpp.
|
protectedvirtual |
deletes autogrow files
Definition at line 53 of file config.cpp.
References config::disks_list, and TLX_LOG1.
| config & add_disk | ( | const disk_config & | cfg | ) |
Add a disk to the configuration list.
Definition at line 181 of file config.cpp.
References config::disks_list, and config::first_flash.
Referenced by config::load_default_config().
|
inline |
Check that initialize() was called.
Definition at line 151 of file config.hpp.
Referenced by block_manager::block_manager(), and config::disk().
|
virtual |
returns the name of the default config file prefix
Definition at line 256 of file config.cpp.
Referenced by config::find_config().
|
virtual |
Returns name of the default I/O implementation.
Definition at line 247 of file config.cpp.
Referenced by config::load_default_config().
|
virtual |
Returns default path of disk.
Definition at line 232 of file config.cpp.
Referenced by config::load_default_config().
| disk_config & disk | ( | size_t | disk | ) |
Returns mutable disk_config structure for additional disk parameters.
Definition at line 219 of file config.cpp.
References config::check_initialized(), and config::disks_list.
Referenced by block_manager::block_manager(), config::disk_io_impl(), config::disk_path(), and config::disk_size().
| const disk_config& disk | ( | size_t | disk | ) | const |
Returns constant disk_config structure for additional disk parameters.
| const std::string & disk_io_impl | ( | size_t | disk | ) | const |
Returns name of I/O implementation of particular disk.
| disk | disk's identifier |
Definition at line 267 of file config.cpp.
References config::disk(), config::disks_list, and config::is_initialized.
| const std::string & disk_path | ( | size_t | disk | ) | const |
Returns path of disks.
| disk | disk's identifier |
Definition at line 226 of file config.cpp.
References config::disk(), config::disks_list, and config::is_initialized.
| external_size_type disk_size | ( | size_t | disk | ) | const |
Returns disk size.
| disk | disk's identifier |
Definition at line 261 of file config.cpp.
References config::disk(), config::disks_list, and config::is_initialized.
|
inline |
Returns number of disks available to user.
Definition at line 195 of file config.hpp.
Referenced by block_manager::block_manager(), buf_istream< BlockType, BidIteratorType >::buf_istream(), buf_istream_reverse< BlockType, BidIteratorType >::buf_istream_reverse(), and striping::striping().
|
protectedvirtual |
Search several places for a config file.
Definition at line 84 of file config.cpp.
References config::default_config_file_name(), foxxll::exist_file(), config::load_config_file(), and config::load_default_config().
Referenced by config::initialize().
| std::pair< unsigned, unsigned > flash_range | ( | ) | const |
Returns contiguous range of flash devices in the array of all disks.
Definition at line 211 of file config.cpp.
References config::disks_list, config::first_flash, and config::is_initialized.
|
protectedvirtual |
If disk list is empty, then search different locations for a disk configuration file, or load a default config if everything fails.
Definition at line 66 of file config.cpp.
References config::disks_list, config::find_config(), config::first_flash, foxxll::get_version_string_long(), config::is_initialized, config::max_device_id_, foxxll::print_library_version_mismatch(), and TLX_LOG1.
|
virtual |
Load disk configuration file.
Definition at line 144 of file config.cpp.
References config::disks_list, config::first_flash, disk_config::flash, FOXXLL_THROW, config::load_default_config(), and disk_config::parse_line().
Referenced by config::find_config().
|
virtual |
Load default configuration.
Definition at line 133 of file config.cpp.
References config::add_disk(), disk_config::autogrow, config::default_disk_io_impl(), config::default_disk_path(), disk_config::delete_on_exit, and TLX_LOG1.
Referenced by config::find_config(), and config::load_config_file().
| unsigned int max_device_id | ( | ) |
Returns automatic physical device id counter.
Definition at line 189 of file config.cpp.
References config::max_device_id_.
Referenced by buf_istream< BlockType, BidIteratorType >::buf_istream(), and buf_istream_reverse< BlockType, BidIteratorType >::buf_istream_reverse().
| unsigned int next_device_id | ( | ) |
Returns next automatic physical device id counter.
Definition at line 194 of file config.cpp.
References config::max_device_id_.
Referenced by foxxll::create_file().
| std::pair< unsigned, unsigned > regular_disk_range | ( | ) | const |
Returns contiguous range of regular disks w/o flash devices in the array of all disks.
Definition at line 205 of file config.cpp.
References config::first_flash, and config::is_initialized.
| external_size_type total_size | ( | ) | const |
Returns the total size over all disks.
Definition at line 273 of file config.cpp.
References config::disks_list, and config::is_initialized.
| void update_max_device_id | ( | unsigned int | devid | ) |
Update the automatic physical device id counter.
Definition at line 199 of file config.cpp.
References config::max_device_id_.
Referenced by foxxll::create_file().
|
private |
list of configured disks
Definition at line 122 of file config.hpp.
Referenced by config::add_disk(), config::disk(), config::disk_io_impl(), config::disk_path(), config::disk_size(), config::flash_range(), config::initialize(), config::load_config_file(), config::total_size(), and config::~config().
|
private |
In disks_list, flash devices come after all regular disks.
Definition at line 125 of file config.hpp.
Referenced by config::add_disk(), config::flash_range(), config::initialize(), config::load_config_file(), and config::regular_disk_range().
|
private |
Finished initializing config.
Definition at line 128 of file config.hpp.
Referenced by config::disk_io_impl(), config::disk_path(), config::disk_size(), config::flash_range(), config::initialize(), config::regular_disk_range(), and config::total_size().
|
protected |
static counter for automatic physical device enumeration
Definition at line 175 of file config.hpp.
Referenced by config::initialize(), config::max_device_id(), config::next_device_id(), and config::update_max_device_id().