00001 #ifndef __vaulter_h__ 00002 #define __vaulter_h__ 00003 00004 #include "asserts.h" 00005 #include "rconfig.h" 00006 #include "logger.h" 00007 00008 /** Select, monitor, and prepare vaults */ 00009 class vault_manager 00010 { 00011 public: 00012 enum vault_manager_overflow_type { 00013 quit, 00014 delete_oldest, 00015 delete_until_free 00016 }; 00017 enum vault_manager_selection_type { 00018 max_free, 00019 round_robbin 00020 }; 00021 00022 vault_manager(); 00023 00024 void clear(void); 00025 void init(void); 00026 const bool initialized(void) const; 00027 00028 void select(void); 00029 const std::string vault(void) const; 00030 const bool selected(void) const; 00031 void usage(uint16 &a_blocks, uint16 &a_inodes) const; 00032 const bool overflow(bool a_report = false); 00033 void delete_oldest_archive(void); 00034 void prepare(bool a_assume_overflow = false); 00035 const std::vector<std::string>& deleted_archives(void) const; 00036 const bool err_deleted_archives(void) const; 00037 00038 const subdirectory get_archive_list(void); 00039 00040 private: 00041 std::string m_selected_vault; 00042 std::vector<std::string> m_deleted_archives; 00043 bool m_da_err; 00044 bool m_initialized; 00045 simple_lock m_lock; 00046 }; 00047 00048 extern vault_manager vaulter; 00049 00050 #endif