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

Detailed Description

Encapsulate the configuration of one "disk". The disk is actually a file I/O object which block_manager uses to read/write blocks.

Definition at line 35 of file config.h.

Public Member Functions

 disk_config ()
 default constructor More...
 
 disk_config (const std::string &path, uint64 size, const std::string &fileio)
 initializing constructor, also parses fileio parameter More...
 
 disk_config (const std::string &line)
 initializing constructor, parse full line as in config files More...
 
std::string fileio_string () const
 return formatted fileio name and optional configuration parameters More...
 
void parse_fileio ()
 parse the "io_impl" parameter into the optional parameter fields. More...
 
void parse_line (const std::string &line)
 parse a disk=<path>,<size>,<fileio> options line into disk_config, throws std::runtime_error on parse errors. More...
 

Public Attributes

Basic Disk Configuration Parameters
std::string path
 the file path used by the io implementation More...
 
uint64 size
 file size to initially allocate More...
 
std::string io_impl
 io implementation to access file More...
 

Optional Disk / File I/O Implementation Parameters

enum  direct_type { DIRECT_OFF = 0, DIRECT_TRY = 1, DIRECT_ON = 2 }
 tristate variable: direct=0 -> force direct OFF, direct=1 -> try direct ON, if fails print warning and open without direct, direct=2 -> force direct ON, fail if unavailable. More...
 
bool autogrow
 autogrow file if more disk space is needed, automatically set if size == 0. More...
 
bool delete_on_exit
 delete file on program exit (default for autoconfigurated files) More...
 
enum
stxxl::disk_config::direct_type 
direct
 
bool flash
 marks flash drives (configuration entries with flash= instead of disk=) More...
 
int queue
 select request queue for disk. Use different queues for files on different disks. queue=-1 -> default queue (one for each disk). More...
 
bool raw_device
 turned on by syscall fileio when the path points to a raw block device More...
 
bool unlink_on_open
 unlink file immediately after opening (available on most Unix) More...
 

Member Enumeration Documentation

tristate variable: direct=0 -> force direct OFF, direct=1 -> try direct ON, if fails print warning and open without direct, direct=2 -> force direct ON, fail if unavailable.

Enumerator
DIRECT_OFF 
DIRECT_TRY 
DIRECT_ON 

Definition at line 85 of file config.h.

Constructor & Destructor Documentation

stxxl::disk_config::disk_config ( )

default constructor

Definition at line 190 of file config.cpp.

stxxl::disk_config::disk_config ( const std::string &  path,
uint64  size,
const std::string &  fileio 
)

initializing constructor, also parses fileio parameter

Definition at line 201 of file config.cpp.

References parse_fileio().

stxxl::disk_config::disk_config ( const std::string &  line)

initializing constructor, parse full line as in config files

Definition at line 217 of file config.cpp.

References parse_line().

Member Function Documentation

std::string stxxl::disk_config::fileio_string ( ) const

return formatted fileio name and optional configuration parameters

Definition at line 381 of file config.cpp.

References autogrow, stxxl::file::DEFAULT_QUEUE, delete_on_exit, direct, DIRECT_OFF, DIRECT_ON, DIRECT_TRY, flash, io_impl, queue, raw_device, and unlink_on_open.

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

void stxxl::disk_config::parse_fileio ( )

parse the "io_impl" parameter into the optional parameter fields.

Definition at line 292 of file config.cpp.

References autogrow, delete_on_exit, direct, DIRECT_OFF, DIRECT_ON, DIRECT_TRY, io_impl, raw_device, stxxl::split(), STXXL_THROW, and unlink_on_open.

Referenced by disk_config(), and parse_line().

void stxxl::disk_config::parse_line ( const std::string &  line)

parse a disk=<path>,<size>,<fileio> options line into disk_config, throws std::runtime_error on parse errors.

Definition at line 230 of file config.cpp.

References autogrow, stxxl::file::DEFAULT_QUEUE, delete_on_exit, direct, DIRECT_TRY, flash, io_impl, parse_fileio(), stxxl::parse_SI_IEC_size(), path, size, stxxl::split(), STXXL_THROW, stxxl::to_str(), and unlink_on_open.

Referenced by disk_config(), and stxxl::config::load_config_file().

Member Data Documentation

bool stxxl::disk_config::autogrow

autogrow file if more disk space is needed, automatically set if size == 0.

Definition at line 77 of file config.h.

Referenced by stxxl::create_file(), fileio_string(), stxxl::config::load_default_config(), parse_fileio(), and parse_line().

bool stxxl::disk_config::delete_on_exit

delete file on program exit (default for autoconfigurated files)

Definition at line 80 of file config.h.

Referenced by stxxl::create_file(), fileio_string(), stxxl::config::load_default_config(), parse_fileio(), and parse_line().

bool stxxl::disk_config::flash

marks flash drives (configuration entries with flash= instead of disk=)

Definition at line 88 of file config.h.

Referenced by fileio_string(), stxxl::config::load_config_file(), and parse_line().

std::string stxxl::disk_config::io_impl

io implementation to access file

Definition at line 48 of file config.h.

Referenced by stxxl::create_file(), fileio_string(), parse_fileio(), and parse_line().

std::string stxxl::disk_config::path

the file path used by the io implementation

Definition at line 42 of file config.h.

Referenced by stxxl::block_manager::block_manager(), stxxl::create_file(), stxxl::config::load_default_config(), and parse_line().

int stxxl::disk_config::queue

select request queue for disk. Use different queues for files on different disks. queue=-1 -> default queue (one for each disk).

Definition at line 92 of file config.h.

Referenced by stxxl::block_manager::block_manager(), stxxl::create_file(), and fileio_string().

bool stxxl::disk_config::raw_device

turned on by syscall fileio when the path points to a raw block device

Definition at line 95 of file config.h.

Referenced by stxxl::create_file(), fileio_string(), and parse_fileio().

uint64 stxxl::disk_config::size

file size to initially allocate

Definition at line 45 of file config.h.

Referenced by stxxl::block_manager::block_manager(), stxxl::create_file(), stxxl::disk_allocator::disk_allocator(), and parse_line().

bool stxxl::disk_config::unlink_on_open

unlink file immediately after opening (available on most Unix)

Definition at line 98 of file config.h.

Referenced by stxxl::create_file(), fileio_string(), parse_fileio(), and parse_line().


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