vault_manager Class Reference

Select, monitor, and prepare vaults. More...

#include <vaulter.h>

Collaboration diagram for vault_manager:

Collaboration graph
[legend]
List of all members.

Public Types

enum  vault_manager_overflow_type { quit, delete_oldest, delete_until_free }
enum  vault_manager_selection_type { max_free, round_robbin }

Public Member Functions

 vault_manager ()
 C'tor.
void clear (void)
 Clear the vault manager.
void init (void)
 Initialize the vault manager.
const bool initialized (void) const
 Return the initialized status of the vault manager.
void select (void)
 Select a vault.
const std::string vault (void) const
 Return the path to the selected vault.
const bool selected (void) const
 Return whether or not a vault has been selected yet.
void usage (uint16 &a_blocks, uint16 &a_inodes) const
 Return the percent of used blocks and used inodes in the selected vault.
const bool overflow (bool a_report=false)
 Test to see if a vault has exceeded it's overflow threshold.
void delete_oldest_archive (void)
 Find the oldest archive in the vault and delete it.
void prepare (bool a_assume_overflow=false)
 Prepare the selected vault.
const std::vector< std::string > & deleted_archives (void) const
 Return a list of deleted archives.
const bool err_deleted_archives (void) const
 Return whether or not there was an error deleting archives.
const subdirectory get_archive_list (void)
 Return a list of archive directories in the selected vault.

Private Attributes

std::string m_selected_vault
std::vector< std::string > m_deleted_archives
bool m_da_err
bool m_initialized
simple_lock m_lock

Detailed Description

Select, monitor, and prepare vaults.

Definition at line 9 of file vaulter.h.


Member Enumeration Documentation

enum vault_manager::vault_manager_overflow_type
 

Enumeration values:
quit 
delete_oldest 
delete_until_free 

Definition at line 12 of file vaulter.h.

enum vault_manager::vault_manager_selection_type
 

Enumeration values:
max_free 
round_robbin 

Definition at line 17 of file vaulter.h.


Constructor & Destructor Documentation

vault_manager::vault_manager  ) 
 

C'tor.

Definition at line 22 of file vaulter.cc.

References clear(), INTERNAL_ERROR, and vaulter.

Here is the call graph for this function:


Member Function Documentation

void vault_manager::clear void   ) 
 

Clear the vault manager.

Definition at line 30 of file vaulter.cc.

References simple_lock::clear(), m_da_err, m_deleted_archives, m_initialized, m_lock, and m_selected_vault.

Referenced by init(), test_rvm(), test_vaulter(), and vault_manager().

Here is the call graph for this function:

void vault_manager::delete_oldest_archive void   ) 
 

Find the oldest archive in the vault and delete it.

Definition at line 432 of file vaulter.cc.

References exitstat::assign(), config, configuration_manager::delete_old_log_files(), configuration_manager::delete_old_report_files(), timer::duration(), ERROR, exit_manager, get_archive_list(), initialized(), INTERNAL_ERROR, configuration_manager::log_dir(), logger, m_da_err, m_deleted_archives, subdirectory::path(), percent_string(), reporter, rm_file(), rm_recursive(), selected(), timer::start(), timer::stop(), configuration_manager::timestamp(), TRY_nomem, usage(), report_manager::vault(), vault(), exitstat::vault_full, and log_manager::write().

Referenced by prepare(), and test_vaulter().

Here is the call graph for this function:

const std::vector< std::string > & vault_manager::deleted_archives void   )  const
 

Return a list of deleted archives.

Definition at line 732 of file vaulter.cc.

References initialized(), INTERNAL_ERROR, and m_deleted_archives.

Referenced by test_vaulter().

Here is the call graph for this function:

const bool vault_manager::err_deleted_archives void   )  const
 

Return whether or not there was an error deleting archives.

Definition at line 741 of file vaulter.cc.

References initialized(), INTERNAL_ERROR, and m_da_err.

Here is the call graph for this function:

const subdirectory vault_manager::get_archive_list void   ) 
 

Return a list of archive directories in the selected vault.

Return a list of archive directories in the selected vault, including incomplete archives. Ignore all other directories.

Definition at line 262 of file vaulter.cc.

References initialized(), INTERNAL_ERROR, is_timestamp(), subdirectory::path(), selected(), and vault().

Referenced by delete_oldest_archive(), test_vaulter(), and test_vaulter3().

Here is the call graph for this function:

void vault_manager::init void   ) 
 

Initialize the vault manager.

Definition at line 40 of file vaulter.cc.

References clear(), and m_initialized.

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

Here is the call graph for this function:

const bool vault_manager::initialized void   )  const
 

Return the initialized status of the vault manager.

Definition at line 47 of file vaulter.cc.

References m_initialized.

Referenced by delete_oldest_archive(), deleted_archives(), err_deleted_archives(), get_archive_list(), overflow(), prepare(), select(), selected(), usage(), and vault().

const bool vault_manager::overflow bool  a_report = false  ) 
 

Test to see if a vault has exceeded it's overflow threshold.

Definition at line 378 of file vaulter.cc.

References config, initialized(), INTERNAL_ERROR, logger, percent_string(), reporter, selected(), TRY_nomem, usage(), report_manager::vault(), vault(), configuration_manager::vault_overflow_blocks(), configuration_manager::vault_overflow_inodes(), and log_manager::write().

Referenced by archive_manager::archive(), archive_manager::mf_log_status(), job_archiver::mf_process_rsync_io(), and prepare().

Here is the call graph for this function:

void vault_manager::prepare bool  a_assume_overflow = false  ) 
 

Prepare the selected vault.

Check the selected vault for overflow. If the overflow threshold has been exceeded and the vault-overflow-behavior setting is not quit, then delete the oldest archive in the vault. Depending on vault-overflow-behavior, possibly repeat this action until either there is space free or there are no archives left in the vault.

Definition at line 664 of file vaulter.cc.

References exitstat::assign(), config, delete_oldest_archive(), ERROR, exit_manager, initialized(), INTERNAL_ERROR, logger, m_deleted_archives, overflow(), configuration_manager::overflow_delete_oldest, configuration_manager::overflow_delete_until_free, configuration_manager::overflow_quit, selected(), TRY, TRY_nomem, vault(), exitstat::vault_full, configuration_manager::vault_overflow_behavior(), and log_manager::write().

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

Here is the call graph for this function:

void vault_manager::select void   ) 
 

Select a vault.

If an archive of the same timestamp for the given timestamp resolution already exists on any vault, then that vault is selected. Otherwise select a vault according to vault-selection-behavior.

Definition at line 59 of file vaulter.cc.

References simple_lock::clear(), config, err_nomem, err_unknown, ERROR, ERROR_INSTANCE, filesystem::free_blocks(), initialized(), INTERNAL_ERROR, simple_lock::is_locked(), simple_lock::lock(), simple_lock::locked_by(), simple_lock::lockfile(), logger, m_lock, m_selected_vault, filesystem::path(), subdirectory::path(), error::push_back(), configuration_manager::selection_round_robin, configuration_manager::timestamp(), TRY_nomem, configuration_manager::vault_locking(), configuration_manager::vault_selection_behavior(), configuration_manager::vaults(), and log_manager::write().

Referenced by archive_manager::init(), test_vaulter(), test_vaulter1(), test_vaulter2(), and test_vaulter3().

Here is the call graph for this function:

const bool vault_manager::selected void   )  const
 

Return whether or not a vault has been selected yet.

Definition at line 303 of file vaulter.cc.

References initialized(), INTERNAL_ERROR, and m_selected_vault.

Referenced by delete_oldest_archive(), get_archive_list(), overflow(), prepare(), usage(), and vault().

Here is the call graph for this function:

void vault_manager::usage uint16 &  a_blocks,
uint16 &  a_inodes
const
 

Return the percent of used blocks and used inodes in the selected vault.

Definition at line 317 of file vaulter.cc.

References ASSERT, filesystem::free_blocks(), filesystem::free_inodes(), initialized(), INTERNAL_ERROR, logger, max_limit(), filesystem::path(), selected(), filesystem::total_blocks(), filesystem::total_inodes(), safe_num< T >::value(), vault(), and log_manager::write().

Referenced by delete_oldest_archive(), and overflow().

Here is the call graph for this function:

const std::string vault_manager::vault void   )  const
 

Return the path to the selected vault.

Definition at line 291 of file vaulter.cc.

References initialized(), INTERNAL_ERROR, m_selected_vault, and selected().

Referenced by archive_manager::archive(), archive_manager::archive_path(), delete_oldest_archive(), vault_report::format_synopsis(), get_archive_list(), archive_manager::init(), job_archiver::mf_do_chores(), overflow(), prepare(), test_rvm(), test_vaulter(), test_vaulter1(), test_vaulter2(), test_vaulter3(), and usage().

Here is the call graph for this function:


Member Data Documentation

bool vault_manager::m_da_err [private]
 

Definition at line 43 of file vaulter.h.

Referenced by clear(), delete_oldest_archive(), and err_deleted_archives().

std::vector<std::string> vault_manager::m_deleted_archives [private]
 

Definition at line 42 of file vaulter.h.

Referenced by clear(), delete_oldest_archive(), deleted_archives(), and prepare().

bool vault_manager::m_initialized [private]
 

Definition at line 44 of file vaulter.h.

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

simple_lock vault_manager::m_lock [private]
 

Definition at line 45 of file vaulter.h.

Referenced by clear(), and select().

std::string vault_manager::m_selected_vault [private]
 

Definition at line 41 of file vaulter.h.

Referenced by clear(), select(), selected(), and vault().


The documentation for this class was generated from the following files:
Generated on Fri Jun 23 16:59:12 2006 for rvm by  doxygen 1.4.2