rvm  1.11
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
configuration_manager Class Reference

Keep up with configuration settings for RVM and it's jobs. More...

#include <rconfig.h>

Collaboration diagram for configuration_manager:
Collaboration graph

Public Types

enum  action_type {
  action_help, action_version, action_archive, action_relink,
  action_check_config
}
 
enum  cfgfile_type { config_file, job_file }
 
enum  overflow_type { overflow_quit, overflow_delete_oldest, overflow_delete_until_free }
 
enum  selection_type { selection_round_robin, selection_max_free }
 
enum  logging_type { logging_manager, logging_child, logging_rsync }
 
typedef std::pair
< cfgfile_type, std::string > 
cfgfile_element
 
typedef class std::vector
< cfgfile_element
cfgfiles_type
 
typedef std::vector< jobjobs_type
 
typedef std::vector< std::string > vaults_type
 

Public Member Functions

void clear (void)
 Reset configuration to default settings. More...
 
 configuration_manager ()
 C'tor. More...
 
void init (int argc, char const *argv[])
 Initialize the configuration manager from rvm's command line options. More...
 
void check (void) const
 Perform sanity checks on configuration settings. More...
 
const bool initialized (void) const
 Return the initialized state of the configuration manager. More...
 
const action_type action (void) const
 Return the action rvm is to take. More...
 
const bool use_default (void) const
 Return whether or not rvm is to try to read it's default configuration file. More...
 
void default_file (const std::string &a_path)
 Set the default configuration filename. More...
 
const std::string & default_file (void) const
 Return the default configuration filename. More...
 
void default_logdir (const std::string &a_path)
 Return the default log-dir. More...
 
const class timestamptimestamp (void) const
 Return the timestamp of this instance of rvm. More...
 
const std::string & link_catalog_dir (void) const
 Return the link-catalog-dir path. More...
 
const std::string & log_dir (void) const
 Return the log-dir path. More...
 
const bool delete_old_log_files (void) const
 Return the value of delete-old-log-files. More...
 
const bool delete_old_report_files (void) const
 Return the value of delete-old-report-files. More...
 
const std::string & rsync_local_path (void) const
 Return the rsync-local-path. More...
 
const std::string & delete_command_path (void) const
 Return the delete-command-path. More...
 
const std::string & ssh_local_path (void) const
 Return the ssh-local-path. More...
 
const uint16 & rsync_parallel (void) const
 Return the rsync-parallel. More...
 
const uint16 & io_poll_interval (void) const
 Return the number of seconds to sleep between polling for I/O. More...
 
const timestamp::resolution_type timestamp_resolution (void) const
 Return the timestamp-resolution. More...
 
const vaults_typevaults (void) const
 Return the vaults. More...
 
const overflow_typevault_overflow_behavior (void) const
 Return the vault-overflow-behavior. More...
 
const uint16 & vault_overflow_blocks (void) const
 Return the vault-overflow-blocks. More...
 
const uint16 & vault_overflow_inodes (void) const
 Return the vault-overflow-inodes. More...
 
const selection_typevault_selection_behavior (void) const
 Return the vault-selection-behavior. More...
 
const bool vault_locking (void) const
 Return the vault-locking selection. More...
 
const jobdefault_job (void) const
 Return the default job configuration. More...
 
const jobs_typejobs (void) const
 Return a list of jobs. More...
 
const logging_typelogging_level (void) const
 Return the logging-level. More...
 
const logging_typeerror_logging_level (void) const
 Return the error-logging-level. More...
 

Private Member Functions

void read_config (const std::string &a_path)
 Read a configuration file. More...
 
void read_job (const std::string &a_path)
 Read a job configuration file. More...
 

Private Attributes

bool m_initialized
 
uint16 m_configs_read
 
std::string m_default_file
 
action_type m_action
 
bool m_default
 
class timestamp m_timestamp
 
cfgfiles_type m_cfgfiles
 
std::string m_link_catalog_dir
 
std::string m_log_dir
 
std::string m_rsync_local_path
 
std::string m_delete_command_path
 
std::string m_ssh_local_path
 
uint16 m_rsync_parallel
 
uint16 m_io_poll_interval
 
std::vector< std::string > m_vaults
 
overflow_type m_vault_overflow_behavior
 
uint16 m_vault_overflow_blocks
 
uint16 m_vault_overflow_inodes
 
selection_type m_vault_selection_behavior
 
bool m_vault_locking
 
bool m_delete_old_log_files
 
bool m_delete_old_report_files
 
job m_default_job
 
jobs_type m_jobs
 
logging_type m_logging_level
 
logging_type m_error_logging_level
 

Friends

class global_parser
 
class job_parser
 

Detailed Description

Keep up with configuration settings for RVM and it's jobs.

Definition at line 203 of file rconfig.h.

Member Typedef Documentation

typedef std::pair<cfgfile_type, std::string> configuration_manager::cfgfile_element

Definition at line 231 of file rconfig.h.

Definition at line 232 of file rconfig.h.

typedef std::vector<job> configuration_manager::jobs_type

Definition at line 233 of file rconfig.h.

typedef std::vector<std::string> configuration_manager::vaults_type

Definition at line 234 of file rconfig.h.

Member Enumeration Documentation

Enumerator
action_help 
action_version 
action_archive 
action_relink 
action_check_config 

Definition at line 206 of file rconfig.h.

Enumerator
config_file 
job_file 

Definition at line 213 of file rconfig.h.

Enumerator
logging_manager 
logging_child 
logging_rsync 

Definition at line 226 of file rconfig.h.

Enumerator
overflow_quit 
overflow_delete_oldest 
overflow_delete_until_free 

Definition at line 217 of file rconfig.h.

Enumerator
selection_round_robin 
selection_max_free 

Definition at line 222 of file rconfig.h.

Constructor & Destructor Documentation

configuration_manager::configuration_manager ( )

C'tor.

Definition at line 1208 of file rconfig.cc.

References clear(), config, and INTERNAL_ERROR.

Here is the call graph for this function:

Member Function Documentation

const configuration_manager::action_type configuration_manager::action ( void  ) const

Return the action rvm is to take.

Definition at line 1466 of file rconfig.cc.

References initialized(), INTERNAL_ERROR, and m_action.

Referenced by log_manager::init(), and main().

Here is the call graph for this function:

void configuration_manager::check ( void  ) const

Perform sanity checks on configuration settings.

Definition at line 1379 of file rconfig.cc.

References ERROR, initialized(), INTERNAL_ERROR, jobs(), m_delete_command_path, m_log_dir, m_rsync_local_path, m_vaults, filestatus::path(), subdirectory::path(), error::push_back(), TRY, TRY_instead, and TRY_nomem.

Referenced by init().

Here is the call graph for this function:

void configuration_manager::clear ( void  )
void configuration_manager::default_file ( const std::string &  a_path)

Set the default configuration filename.

Definition at line 1484 of file rconfig.cc.

References m_default_file, and TRY_nomem.

Referenced by test(), test_rvm(), test_vaulter(), test_vaulter1(), test_vaulter2(), and test_vaulter3().

const std::string & configuration_manager::default_file ( void  ) const

Return the default configuration filename.

Definition at line 1490 of file rconfig.cc.

References initialized(), INTERNAL_ERROR, and m_default_file.

Here is the call graph for this function:

const job & configuration_manager::default_job ( void  ) const

Return the default job configuration.

Definition at line 1658 of file rconfig.cc.

References initialized(), INTERNAL_ERROR, and m_default_job.

Referenced by test().

Here is the call graph for this function:

void configuration_manager::default_logdir ( const std::string &  a_path)

Return the default log-dir.

Definition at line 1499 of file rconfig.cc.

References m_log_dir, and TRY_nomem.

Referenced by test().

const std::string & configuration_manager::delete_command_path ( void  ) const

Return the delete-command-path.

Definition at line 1559 of file rconfig.cc.

References initialized(), INTERNAL_ERROR, and m_delete_command_path.

Referenced by vault_manager::delete_oldest_archive().

Here is the call graph for this function:

const bool configuration_manager::delete_old_log_files ( void  ) const

Return the value of delete-old-log-files.

Definition at line 1532 of file rconfig.cc.

References initialized(), INTERNAL_ERROR, and m_delete_old_log_files.

Referenced by vault_manager::delete_oldest_archive(), and test().

Here is the call graph for this function:

const bool configuration_manager::delete_old_report_files ( void  ) const

Return the value of delete-old-report-files.

Definition at line 1541 of file rconfig.cc.

References initialized(), INTERNAL_ERROR, and m_delete_old_report_files.

Referenced by vault_manager::delete_oldest_archive(), and test().

Here is the call graph for this function:

const configuration_manager::logging_type & configuration_manager::error_logging_level ( void  ) const

Return the error-logging-level.

Definition at line 1685 of file rconfig.cc.

References initialized(), INTERNAL_ERROR, and m_error_logging_level.

Referenced by log_manager::write().

Here is the call graph for this function:

void configuration_manager::init ( int  argc,
char const *  argv[] 
)
const bool configuration_manager::initialized ( void  ) const
const uint16 & configuration_manager::io_poll_interval ( void  ) const

Return the number of seconds to sleep between polling for I/O.

Definition at line 1586 of file rconfig.cc.

References initialized(), INTERNAL_ERROR, and m_io_poll_interval.

Referenced by job_archiver::mf_process_child_io(), and job_archiver::mf_process_rsync_io().

Here is the call graph for this function:

const configuration_manager::jobs_type & configuration_manager::jobs ( void  ) const

Return a list of jobs.

Definition at line 1667 of file rconfig.cc.

References initialized(), INTERNAL_ERROR, and m_jobs.

Referenced by archive_manager::archive(), job::check(), check(), test(), and test_rvm().

Here is the call graph for this function:

const std::string & configuration_manager::link_catalog_dir ( void  ) const

Return the link-catalog-dir path.

Definition at line 1514 of file rconfig.cc.

References initialized(), INTERNAL_ERROR, and m_link_catalog_dir.

Referenced by catalog_manager::catalog(), catalog_manager::erase(), and test().

Here is the call graph for this function:

const std::string & configuration_manager::log_dir ( void  ) const

Return the log-dir path.

Definition at line 1523 of file rconfig.cc.

References initialized(), INTERNAL_ERROR, and m_log_dir.

Referenced by vault_manager::delete_oldest_archive(), report_manager::file_report(), log_manager::init(), test(), and test_rvm().

Here is the call graph for this function:

const configuration_manager::logging_type & configuration_manager::logging_level ( void  ) const

Return the logging-level.

Definition at line 1676 of file rconfig.cc.

References initialized(), INTERNAL_ERROR, and m_logging_level.

Referenced by log_manager::write().

Here is the call graph for this function:

void configuration_manager::read_config ( const std::string &  a_path)
private

Read a configuration file.

Definition at line 1694 of file rconfig.cc.

References ERROR, global_parser, m_configs_read, and TRY_nomem.

Referenced by init().

void configuration_manager::read_job ( const std::string &  a_path)
private

Read a job configuration file.

Definition at line 1715 of file rconfig.cc.

References job::check(), ERROR, job_parser, m_default_job, and TRY_nomem.

Referenced by init().

Here is the call graph for this function:

const std::string & configuration_manager::rsync_local_path ( void  ) const

Return the rsync-local-path.

Definition at line 1550 of file rconfig.cc.

References initialized(), INTERNAL_ERROR, and m_rsync_local_path.

Referenced by job_archiver::mf_do_chores(), and test().

Here is the call graph for this function:

const uint16 & configuration_manager::rsync_parallel ( void  ) const

Return the rsync-parallel.

Definition at line 1577 of file rconfig.cc.

References initialized(), INTERNAL_ERROR, and m_rsync_parallel.

Referenced by archive_manager::archive(), and test().

Here is the call graph for this function:

const std::string & configuration_manager::ssh_local_path ( void  ) const

Return the ssh-local-path.

Definition at line 1568 of file rconfig.cc.

References initialized(), INTERNAL_ERROR, and m_ssh_local_path.

Referenced by job_archiver::mf_do_chores().

Here is the call graph for this function:

const class timestamp & configuration_manager::timestamp ( void  ) const
const timestamp::resolution_type configuration_manager::timestamp_resolution ( void  ) const

Return the timestamp-resolution.

Definition at line 1595 of file rconfig.cc.

References initialized(), INTERNAL_ERROR, m_timestamp, and timestamp::resolution().

Referenced by test().

Here is the call graph for this function:

const bool configuration_manager::use_default ( void  ) const

Return whether or not rvm is to try to read it's default configuration file.

Definition at line 1475 of file rconfig.cc.

References initialized(), INTERNAL_ERROR, and m_default.

Referenced by init().

Here is the call graph for this function:

const bool configuration_manager::vault_locking ( void  ) const

Return the vault-locking selection.

Definition at line 1649 of file rconfig.cc.

References initialized(), INTERNAL_ERROR, and m_vault_locking.

Referenced by vault_manager::select(), and test().

Here is the call graph for this function:

const configuration_manager::overflow_type & configuration_manager::vault_overflow_behavior ( void  ) const

Return the vault-overflow-behavior.

Definition at line 1613 of file rconfig.cc.

References initialized(), INTERNAL_ERROR, and m_vault_overflow_behavior.

Referenced by vault_manager::prepare(), and test().

Here is the call graph for this function:

const uint16 & configuration_manager::vault_overflow_blocks ( void  ) const

Return the vault-overflow-blocks.

Definition at line 1622 of file rconfig.cc.

References initialized(), INTERNAL_ERROR, and m_vault_overflow_blocks.

Referenced by vault_manager::overflow(), and test().

Here is the call graph for this function:

const uint16 & configuration_manager::vault_overflow_inodes ( void  ) const

Return the vault-overflow-inodes.

Definition at line 1631 of file rconfig.cc.

References initialized(), INTERNAL_ERROR, and m_vault_overflow_inodes.

Referenced by vault_manager::overflow(), and test().

Here is the call graph for this function:

const configuration_manager::selection_type & configuration_manager::vault_selection_behavior ( void  ) const

Return the vault-selection-behavior.

Definition at line 1640 of file rconfig.cc.

References initialized(), INTERNAL_ERROR, and m_vault_selection_behavior.

Referenced by vault_manager::select(), and test().

Here is the call graph for this function:

const configuration_manager::vaults_type & configuration_manager::vaults ( void  ) const

Return the vaults.

Definition at line 1604 of file rconfig.cc.

References initialized(), INTERNAL_ERROR, and m_vaults.

Referenced by catalog_manager::catalog(), vault_manager::select(), and test().

Here is the call graph for this function:

Friends And Related Function Documentation

friend class global_parser
friend

Definition at line 299 of file rconfig.h.

Referenced by read_config().

friend class job_parser
friend

Definition at line 300 of file rconfig.h.

Referenced by read_job().

Member Data Documentation

action_type configuration_manager::m_action
private

Definition at line 275 of file rconfig.h.

Referenced by action(), clear(), and init().

cfgfiles_type configuration_manager::m_cfgfiles
private

Definition at line 278 of file rconfig.h.

Referenced by clear(), and init().

uint16 configuration_manager::m_configs_read
private

Definition at line 273 of file rconfig.h.

Referenced by clear(), init(), read_config(), and global_parser::read_config().

bool configuration_manager::m_default
private

Definition at line 276 of file rconfig.h.

Referenced by clear(), init(), and use_default().

std::string configuration_manager::m_default_file
private

Definition at line 274 of file rconfig.h.

Referenced by clear(), default_file(), and init().

job configuration_manager::m_default_job
private
std::string configuration_manager::m_delete_command_path
private
bool configuration_manager::m_delete_old_log_files
private
bool configuration_manager::m_delete_old_report_files
private
logging_type configuration_manager::m_error_logging_level
private

Definition at line 297 of file rconfig.h.

Referenced by clear(), error_logging_level(), and global_parser::parse_error_logging_level().

bool configuration_manager::m_initialized
private

Definition at line 272 of file rconfig.h.

Referenced by clear(), init(), and initialized().

uint16 configuration_manager::m_io_poll_interval
private

Definition at line 285 of file rconfig.h.

Referenced by clear(), io_poll_interval(), and global_parser::parse_io_poll_interval().

jobs_type configuration_manager::m_jobs
private

Definition at line 295 of file rconfig.h.

Referenced by clear(), jobs(), global_parser::parse_include_job(), and global_parser::parse_job().

std::string configuration_manager::m_link_catalog_dir
private

Definition at line 279 of file rconfig.h.

Referenced by clear(), link_catalog_dir(), and global_parser::parse_link_catalog_dir().

std::string configuration_manager::m_log_dir
private

Definition at line 280 of file rconfig.h.

Referenced by check(), clear(), default_logdir(), log_dir(), and global_parser::parse_log_dir().

logging_type configuration_manager::m_logging_level
private

Definition at line 296 of file rconfig.h.

Referenced by clear(), logging_level(), and global_parser::parse_logging_level().

std::string configuration_manager::m_rsync_local_path
private

Definition at line 281 of file rconfig.h.

Referenced by check(), clear(), global_parser::parse_rsync_local_path(), and rsync_local_path().

uint16 configuration_manager::m_rsync_parallel
private

Definition at line 284 of file rconfig.h.

Referenced by clear(), global_parser::parse_rsync_parallel(), and rsync_parallel().

std::string configuration_manager::m_ssh_local_path
private

Definition at line 283 of file rconfig.h.

Referenced by clear(), global_parser::parse_ssh_local_path(), and ssh_local_path().

class timestamp configuration_manager::m_timestamp
private
bool configuration_manager::m_vault_locking
private

Definition at line 291 of file rconfig.h.

Referenced by clear(), global_parser::parse_vault_locking(), and vault_locking().

overflow_type configuration_manager::m_vault_overflow_behavior
private
uint16 configuration_manager::m_vault_overflow_blocks
private
uint16 configuration_manager::m_vault_overflow_inodes
private
selection_type configuration_manager::m_vault_selection_behavior
private
std::vector<std::string> configuration_manager::m_vaults
private

Definition at line 286 of file rconfig.h.

Referenced by check(), clear(), global_parser::parse_vault(), and vaults().


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