STXXL  1.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
stxxl::config Class Reference

Detailed Description

Access point to disks properties. Since 1.4.0: no config files are read automatically!

Remarks
is a singleton

Definition at line 112 of file config.h.

+ Inheritance diagram for stxxl::config:
+ Collaboration diagram for stxxl::config:

Public Member Functions

Initialization Functions
void check_initialized ()
 Check that initialize() was called. More...
 
void load_config_file (const std::string &config_path)
 Load disk configuration file. More...
 
void load_default_config ()
 Load default configuration. More...
 
configadd_disk (const disk_config &cfg)
 Add a disk to the configuration list. More...
 
Query Functions
size_t disks_number ()
 Returns number of disks available to user. More...
 
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
 Returns contiguous range of flash devices in the array of all disks. More...
 
disk_configdisk (size_t disk)
 Returns mutable disk_config structure for additional disk parameters. More...
 
const disk_configdisk (size_t disk) const
 Returns constant disk_config structure for additional disk parameters. More...
 
const std::string & disk_path (size_t disk) const
 Returns path of disks. More...
 
stxxl::uint64 disk_size (size_t disk) const
 Returns disk size. More...
 
const std::string & disk_io_impl (size_t disk) const
 Returns name of I/O implementation of particular disk. More...
 
uint64 total_size () const
 Returns the total size over all disks. More...
 

Private Types

typedef std::vector< disk_configdisk_list_type
 typedef of list of configured disks More...
 

Private Member Functions

 config ()
 Constructor: this must be inlined to print the header version string. More...
 
 ~config ()
 deletes autogrow files More...
 
void find_config ()
 Search several places for a config file. More...
 
void initialize ()
 If disk list is empty, then search different locations for a disk configuration file, or load a default config if everything fails. 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 m_max_device_id
 static counter for automatic physical device enumeration More...
 
unsigned int get_max_device_id ()
 Returns automatic physical device id counter. More...
 
unsigned int get_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

- Static Public Member Functions inherited from stxxl::singleton< config >
static instance_pointer get_instance ()
 

Member Typedef Documentation

typedef std::vector<disk_config> stxxl::config::disk_list_type
private

typedef of list of configured disks

Definition at line 117 of file config.h.

Constructor & Destructor Documentation

stxxl::config::config ( )
inlineprivate

Constructor: this must be inlined to print the header version string.

Definition at line 130 of file config.h.

References stxxl::get_version_string_long(), stxxl::print_library_version_mismatch(), and STXXL_MSG.

stxxl::config::~config ( )
private

deletes autogrow files

Definition at line 42 of file config.cpp.

References STXXL_ERRMSG.

Member Function Documentation

config& stxxl::config::add_disk ( const disk_config cfg)
inline

Add a disk to the configuration list.

Warning
This function should only be used during initialization, as it has no effect after construction of block_manager.

Definition at line 170 of file config.h.

void stxxl::config::check_initialized ( )
inline

Check that initialize() was called.

Note
This function need not be called by the user, block_manager will always call it.

Definition at line 155 of file config.h.

Referenced by stxxl::block_manager::block_manager().

disk_config& stxxl::config::disk ( size_t  disk)
inline

Returns mutable disk_config structure for additional disk parameters.

Definition at line 226 of file config.h.

Referenced by stxxl::block_manager::block_manager().

const disk_config& stxxl::config::disk ( size_t  disk) const
inline

Returns constant disk_config structure for additional disk parameters.

Definition at line 233 of file config.h.

const std::string& stxxl::config::disk_io_impl ( size_t  disk) const
inline

Returns name of I/O implementation of particular disk.

Parameters
diskdisk's identifier

Definition at line 259 of file config.h.

const std::string& stxxl::config::disk_path ( size_t  disk) const
inline

Returns path of disks.

Parameters
diskdisk's identifier
Returns
string that contains the disk's path name

Definition at line 242 of file config.h.

stxxl::uint64 stxxl::config::disk_size ( size_t  disk) const
inline

Returns disk size.

Parameters
diskdisk's identifier
Returns
disk size in bytes

Definition at line 251 of file config.h.

size_t stxxl::config::disks_number ( )
inline

Returns number of disks available to user.

Returns
number of disks

Definition at line 203 of file config.h.

Referenced by stxxl::block_manager::block_manager(), and stxxl::stable_ksort().

void stxxl::config::find_config ( )
private

Search several places for a config file.

Definition at line 68 of file config.cpp.

References stxxl::exist_file().

std::pair<unsigned, unsigned> stxxl::config::flash_range ( ) const
inline

Returns contiguous range of flash devices in the array of all disks.

Returns
range [begin, end) of flash device indices

Definition at line 219 of file config.h.

unsigned int stxxl::config::get_max_device_id ( )

Returns automatic physical device id counter.

Definition at line 178 of file config.cpp.

unsigned int stxxl::config::get_next_device_id ( )

Returns next automatic physical device id counter.

Definition at line 184 of file config.cpp.

void stxxl::config::initialize ( )
private

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 55 of file config.cpp.

void stxxl::config::load_config_file ( const std::string &  config_path)

Load disk configuration file.

Definition at line 142 of file config.cpp.

References stxxl::disk_config::flash, stxxl::disk_config::parse_line(), and STXXL_THROW.

void stxxl::config::load_default_config ( )
std::pair<unsigned, unsigned> stxxl::config::regular_disk_range ( ) const
inline

Returns contiguous range of regular disks w/o flash devices in the array of all disks.

Returns
range [begin, end) of regular disk indices

Definition at line 211 of file config.h.

uint64 stxxl::config::total_size ( ) const

Returns the total size over all disks.

Definition at line 196 of file config.cpp.

void stxxl::config::update_max_device_id ( unsigned int  devid)

Update the automatic physical device id counter.

Definition at line 190 of file config.cpp.

Member Data Documentation

disk_list_type stxxl::config::disks_list
private

list of configured disks

Definition at line 120 of file config.h.

unsigned stxxl::config::first_flash
private

In disks_list, flash devices come after all regular disks.

Definition at line 123 of file config.h.

bool stxxl::config::is_initialized
private

Finished initializing config.

Definition at line 126 of file config.h.

unsigned int stxxl::config::m_max_device_id
protected

static counter for automatic physical device enumeration

Definition at line 183 of file config.h.


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