40 const std::string& a_message,
79 const std::string& a_message,
95 const std::string& a_message,
96 const std::string& a_time,
97 const uint64 a_total_blocks,
98 const uint64 a_free_blocks,
99 const uint64 a_total_inodes,
100 const uint64 a_free_inodes
188 std::vector<vault_stats_report>::const_iterator vi;
189 uint64 ui64b, ui64e, ui64t;
191 estr =
"Vault Statistics";
234 estr = vi->message();
271 estr =
"Total Difference:";
326 estr =
"Vault Selected:";
347 const std::string a_source,
349 const uint16 a_exit_code,
350 const uint16 a_signal_num,
352 const std::string a_error_message
397 const std::string a_source,
399 const uint16 a_exit_code,
400 const uint16 a_signal_num,
402 const std::string a_error_message
519 std::cout <<
tags[
rsync] << a_str << std::endl;
528 std::cerr <<
tags[
rsync] << a_str << std::endl;
535 const std::string a_source,
536 const timer& a_timer,
537 const int a_exit_code,
538 const int a_signal_num,
540 const std::string& a_error_msg
545 str +=
estring(a_source.size());
557 str +=
estring(static_cast<uint64>(a_behavior));
559 str +=
estring(a_error_msg.size());
565 std::cout <<
tags[
report] << str << std::endl;
589 if (idx == std::string::npos) {
592 es =
"Invalid job report: \"";
601 estr.erase(0,idx+strlen(
tags[report]));
603 idx = estr.find(
' ');
604 tmp = estr.substr(0,idx);
607 source = estr.substr(0,size);
608 estr.erase(0,size+1);
610 idx = estr.find(
' ');
611 tmp = estr.substr(0,idx);
613 start_time =
static_cast<uint64
>(tmp);
615 idx = estr.find(
' ');
616 tmp = estr.substr(0,idx);
618 stop_time =
static_cast<uint64
>(tmp);
620 idx = estr.find(
' ');
621 tmp = estr.substr(0,idx);
625 idx = estr.find(
' ');
626 tmp = estr.substr(0,idx);
630 idx = estr.find(
' ');
631 tmp = estr.substr(0,idx);
635 static_cast<uint64
>(tmp)
638 idx = estr.find(
' ');
639 tmp = estr.substr(0,idx);
642 error_msg = estr.substr(0,size);
643 estr.erase(0,size+1);
647 timer(start_time,stop_time),
663 if (idx == std::string::npos) {
718 std::vector<job_path_report>::const_iterator jpri;
762 std::vector<single_job_report>::const_iterator ji;
763 std::vector<job_path_report>::const_iterator jpi;
776 bool first_line =
true;
790 t2 <<
"Job" << vsep <<
"Path" <<
" " <<
" "
792 t2 <<
"Status" << vsep <<
"Status" <<
" " <<
"Source"
794 t2 << hsep << vsep << hsep <<
" " << hsep <<
table_endl;
796 for (jpi = ji->reports().begin(); jpi != ji->reports().end(); ++jpi) {
797 if (jpi != ji->reports().begin())
808 t2 <<
" " << vsep <<
" " <<
" " << table_endl <<
" ";
835 estr2 = jpi->time().started_at();
837 t4 <<
" " << estr <<
" " << estr2 <<
table_endl;
840 estr2 = jpi->time().stopped_at();
842 t4 <<
" " << estr <<
" " << estr2 <<
table_endl;
845 estr2 = jpi->time().duration();
846 t4 <<
" " << estr <<
" " << estr2 <<
table_endl;
851 if (!jpi->status()) {
858 estr2 =
estring(jpi->exit_code());
859 if (jpi->exit_code() != 0) {
863 t5 <<
" " << estr <<
" " << estr2 <<
table_endl;
865 estr =
"Signal Num:";
866 estr2 =
estring(jpi->signal_num());
867 if (jpi->signal_num() != 0) {
871 t5 <<
" " << estr <<
" " << estr2 <<
table_endl;
873 if (jpi->error_msg().size() > 0) {
875 estr2 = jpi->error_msg();
876 t5 <<
" " << estr <<
" " << estr2 <<
table_endl;
897 std::vector<single_job_report>::const_iterator sjri;
898 uint16 jobs_good = 0;
900 uint16 jobs_total = 0;
904 for (sjri =
m_jobs.begin(); sjri !=
m_jobs.end(); ++sjri) {
912 estr =
"Successful Jobs:";
920 a_table << estr <<
" " << estr2 <<
table_endl;
940 throw(
INTERNAL_ERROR(0,
"Configuration manager is not initialized"));
988 lstr =
"Reporter - Printing report to stdout...\n";
993 lstr =
"Reporter - Done\n";
1001 std::string filename;
1024 out.open(filename.c_str());
1025 if (!out.is_open()) {
1026 TRY_nomem(es =
"Could not open report file: \"");
1029 throw(
ERROR(errno,es));
1032 lstr =
"Reporter - Writing report to file...\n";
1038 lstr =
"Reporter - Done\n";
1074 estr =
"Start Time:";
1078 a_table << estr <<
" " << estr2 <<
table_endl;
1080 estr =
"Finish Time:";
1084 a_table << estr <<
" " << estr2 <<
table_endl;
1089 a_table << estr <<
" " << estr2 <<
table_endl;
1097 estr =
"Rsync Vault Manager - ";
single_job_report()
C'tor.
Retrieve information about a filesystem.
const size_type total_inodes(void) const
Return the filesystem's total number of inodes, if supported by the filesystem, otherwise the result ...
log_manager logger
The global log manager.
job_path_report parse(const std::string &a_str)
Parse a received report from a child process and return a job_path_report.
Vault selection and usage report.
void clear(void)
Clear all values.
table & table_endl(table &a_table)
const uint64 free_inodes(void) const
Return the number of free inodes in the vault.
const std::string & error_msg(void) const
Return the error message.
void write_report(std::ostream &a_out)
Format job reports and output to the given stream.
An extended string class.
void add_report(const single_job_report &a_class)
Add a job report to the list.
std::vector< vault_stats_report > m_reports
job_path_report & operator=(const job_path_report &a_class)
Assignment operator.
void format_synopsis(table &a_table)
Generate a synopsis report.
vault_stats_report()
C'tor.
const std::string current_time(void)
Return the current time.
void write_rsync_err(const std::string &a_str)
Write a report line for output from rsync to parent on child's std::cerr.
void mf_write_synopsis(std::ostream &a_out)
std::string percent_string(const T &a_complete, const T &a_total)
Given a count complete and a count total, calculate a percentage.
void write_report(std::ostream &a_out)
Write report to the given stream.
const std::vector< single_job_report > & reports(void) const
Return a const vector of all job reports.
void clear(void)
Clear the timer.
void write(const std::string &a_str, const uint16 a_indention=0, const configuration_manager::logging_type a_logging_level=configuration_manager::logging_manager, const pid_t a_pid=pid())
Write a string to the log file.
const uint64 total_blocks(void) const
Return the total number of blocks in the vault.
const class timestamp & timestamp(void) const
Return the timestamp of this instance of rvm.
const std::string & log_dir(void) const
Return the log-dir path.
class rstat rsync_estat_str
const std::vector< job_path_report > & reports(void) const
Return a const vector of all path reports.
void write_report(std::ostream &a_out)
Format and print the vault report to the given stream.
void set_total_time(const timer &a_class)
Report the overall RVM time.
rsync_behavior::value_type m_behavior
table & table_repeat(table &a_table)
const bool status(void) const
Return true if rsync succeeded archiving this path.
void clear(void)
Clear all values.
void clear(void)
Clear all values.
report_manager reporter
The global report manager.
jobs_report & jobs(void)
Return the jobs reporter object.
const std::string & exit(const int a_int) const
Get a verbose string for an exit code.
bool exists(const std::string &a_path)
Return true if the file or directory exists.
void file_report(void)
Save report to a file.
const std::string & message(void) const
Return the message.
const std::string stopped_at(void) const
Generate a stopped-at string.
const value_type start_value(void) const
Return the timer start value.
~vault_stats_report()
D'tor.
const bool initialized(void) const
Return the initialized state of the configuration manager.
void fillchar(const char a_char)
Set the fill character used for padding both the left and right side of a formatted string...
const std::string vault(void) const
Return the path to the selected vault.
vault_stats_report & operator=(const vault_stats_report &a_class)
Assignment operator.
void add_report(const job_path_report &a_class)
Add a path report for this job.
const std::string & source(void) const
Return a string of the path archived.
void clear(void)
Clear all values.
const size_type free_inodes(void) const
Return the filesystem's total number of free inodes, if supported by the filesystem, otherwise the result is system-dependent, but usually 0.
void assign(const vault_stats_report &a_class)
Assignment.
~single_job_report()
D'tor.
const std::string & signal(const int a_int) const
Get a verbose string for a signal number.
#define INTERNAL_ERROR(e, s)
const std::string & time(void) const
Return a string timestamp.
Job report for an rsync run on a single path.
const std::string started_at(void) const
Generate a started-at string.
configuration_manager config
The global configuration manager instance.
const std::string & id(void) const
Return the descriptive id for this job report.
void format_synopsis(table &a_table)
Generate a synopsis report.
static const char * tags[]
Report type tags.
std::vector< job_path_report > m_reports
vault_report & vault(void)
Return the vault reporter object.
const value_type stop_value(void) const
Return the timer stop value.
void write_report(const std::string a_source, const timer &a_timer, const int a_exit_code, const int a_signal_num, const rsync_behavior::value_type &a_behavior, const std::string &a_error_msg)
Generate and submit a report to the parent process on child's std::cout.
value_type::size_type size_type
The size type.
void print_report(void)
Print report to standard output.
void format_synopsis(table &a_table)
Generate a synopsis report.
void clear(void)
Clear all values.
const size_type free_blocks(void) const
Return the filesystem's number of free blocks.
const std::string duration(void) const
Generate a duration string.
const uint64 total_inodes(void) const
Return the total number of inodes in the vault.
void assign(const job_path_report &a_class)
Assignment.
void add_report(const vault_stats_report &a_class)
Add a vault report to the list.
const timer & time(void) const
Return the timer object for this report.
alignment align(const alignment a_alignment)
Set the alignment used for formatted strings.
const int signal_num(void) const
Return rsync's signal number.
std::vector< single_job_report > m_jobs
void mf_write_header(std::ostream &a_out)
void clear(void)
Clear all values.
bool is_report(const std::string &a_str)
Return true if the given string looks like a valid report.
const uint64 free_blocks(void) const
Return the number of free blocks in the vault.
const std::string str(void) const
Generate a string.
void init(void)
Initialize.
void write_rsync_out(const std::string &a_str)
Write a report line for output from rsync to parent on child's std::cout.
const size_type total_blocks(void) const
Return the filesystem's total number of blocks.
const bool initialized(void) const
Return whether or not this object has been inintialized.
vault_manager vaulter
The global vault manager.
const bool status(void) const
If all path reports say that rsync was successful, then return true, else return false.
const int exit_code(void) const
Return rsync's exit code.