rvm  1.11
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vaulter.h
Go to the documentation of this file.
1 #ifndef __vaulter_h__
2 #define __vaulter_h__
3 
4 #include "asserts.h"
5 #include "rconfig.h"
6 #include "logger.h"
7 
8 /** Select, monitor, and prepare vaults */
10 {
11 public:
16  };
20  };
21 
22  vault_manager();
23 
24  void clear(void);
25  void init(void);
26  const bool initialized(void) const;
27 
28  void select(void);
29  const std::string vault(void) const;
30  const bool selected(void) const;
31  void usage(uint16 &a_blocks, uint16 &a_inodes) const;
32  const bool overflow(bool a_report = false);
33  void delete_oldest_archive(void);
34  void prepare(bool a_assume_overflow = false);
35  const std::vector<std::string>& deleted_archives(void) const;
36  const bool err_deleted_archives(void) const;
37 
38  const subdirectory get_archive_list(void);
39 
40 private:
41  std::string m_selected_vault;
42  std::vector<std::string> m_deleted_archives;
43  bool m_da_err;
46 };
47 
48 extern vault_manager vaulter;
49 
50 #endif
void clear(void)
Clear the vault manager.
Definition: vaulter.cc:30
void init(void)
Initialize the vault manager.
Definition: vaulter.cc:40
simple_lock m_lock
Definition: vaulter.h:45
void usage(uint16 &a_blocks, uint16 &a_inodes) const
Return the percent of used blocks and used inodes in the selected vault.
Definition: vaulter.cc:317
const bool initialized(void) const
Return the initialized status of the vault manager.
Definition: vaulter.cc:47
const bool err_deleted_archives(void) const
Return whether or not there was an error deleting archives.
Definition: vaulter.cc:763
const std::vector< std::string > & deleted_archives(void) const
Return a list of deleted archives.
Definition: vaulter.cc:754
bool m_da_err
Definition: vaulter.h:43
vault_manager_selection_type
Definition: vaulter.h:17
vault_manager()
C'tor.
Definition: vaulter.cc:22
Select, monitor, and prepare vaults.
Definition: vaulter.h:9
std::vector< std::string > m_deleted_archives
Definition: vaulter.h:42
std::string m_selected_vault
Definition: vaulter.h:41
bool m_initialized
Definition: vaulter.h:44
void select(void)
Select a vault.
Definition: vaulter.cc:59
const subdirectory get_archive_list(void)
Return a list of archive directories in the selected vault.
Definition: vaulter.cc:262
A simple locking mechanism.
Definition: fs.h:343
vault_manager_overflow_type
Definition: vaulter.h:12
const std::string vault(void) const
Return the path to the selected vault.
Definition: vaulter.cc:291
void prepare(bool a_assume_overflow=false)
Prepare the selected vault.
Definition: vaulter.cc:686
void delete_oldest_archive(void)
Find the oldest archive in the vault and delete it.
Definition: vaulter.cc:433
const bool overflow(bool a_report=false)
Test to see if a vault has exceeded it's overflow threshold.
Definition: vaulter.cc:378
vault_manager vaulter
The global vault manager.
Definition: vaulter.cc:772
Retrieve a list of files in a subdirectory that match a given wildcard filename.
Definition: fs.h:273
const bool selected(void) const
Return whether or not a vault has been selected yet.
Definition: vaulter.cc:303