#include <archiver.h>
Collaboration diagram for job_archiver:
Public Types | |
enum | archiving_status { status_pending, status_processing, status_retry_later, status_fatal_error, status_error, status_completed, status_done } |
Public Member Functions | |
job_archiver (const job *a_job) | |
C'tor. | |
const std::string | prefix (void) |
Generate a job prefix string. | |
const std::string | id (void) |
Generate a job id string. | |
void | clear (void) |
Clear the job archiver and return it to it's initial state. | |
void | end (void) |
End any processes handling this job. | |
const archiving_status | status (void) |
Return the processing status of this job archiver. | |
void | start (void) |
Begin processing. | |
void | process (void) |
Parent processor for a job. | |
single_job_report | report (void) const |
Return the job report for this job. | |
Private Member Functions | |
void | mf_do_chores (void) |
Child processor for a job. | |
void | mf_process_report (const std::string &a_str) |
void | mf_process_child_io (bool a_finalize) |
Process I/O from the child. | |
void | mf_process_rsync_io (execute &a_exec, uint16 a_timeout, uint64 &a_files_total, uint64 &a_files_xferd, uint64 &a_size_total, uint64 &a_size_xferd, bool &a_overflow_detected) |
Process I/O from rsync. | |
void | mf_parse_rsync_io (std::string a_str, uint64 &a_files_total, uint64 &a_files_xferd, uint64 &a_size_total, uint64 &a_size_xferd) |
Parse I/O from rsync. | |
void | mf_trim_string (std::string &a_str) |
Trim off all non-digit leading and trailing characters from a string. | |
void | mf_parse_report (const std::string &a_str) |
Private Attributes | |
const job * | m_job |
archiving_status | m_status |
timer | m_timer |
execute | m_exec |
bool | m_success |
estring | m_io_out |
estring | m_io_err |
pid_t | m_child_pid |
job_path_report | m_jpr |
single_job_report | m_jr |
std::string | m_error_msg |
Definition at line 36 of file archiver.h.
|
Definition at line 38 of file archiver.h. |
|
C'tor. Set a job to be assiciated with this job archiver and initialize it's processing status to "pending". Definition at line 121 of file archiver.cc. References clear(), m_job, m_status, and status_pending. Here is the call graph for this function: |
|
Clear the job archiver and return it to it's initial state. End any processes handling this job and return the job archiver to it's "pending" state. Definition at line 163 of file archiver.cc. References job_path_report::clear(), single_job_report::clear(), end(), m_child_pid, m_error_msg, m_exec, m_jpr, m_jr, m_status, m_success, execute::my_pid(), and status_pending. Referenced by job_archiver(). Here is the call graph for this function: |
|
End any processes handling this job. If any child processes are handling this job, terminate them. Erase any pending I/O for the now defunct child. Set our processing status to "done". Definition at line 180 of file archiver.cc. References execute::child_running(), execute::clear(), execute::kill_child(), logger, configuration_manager::logging_manager, m_child_pid, m_exec, m_io_err, m_io_out, m_status, m_timer, prefix(), status_done, timer::stop(), and log_manager::write(). Referenced by clear(). Here is the call graph for this function: |
|
Generate a job id string.
Definition at line 146 of file archiver.cc. References job::generate_job_id(), m_job, and prefix(). Here is the call graph for this function: |
|
|
|
|
Parse I/O from rsync. Search for special output from rsync to tell us something about the number and size of files and files transfered. Definition at line 727 of file archiver.cc. References err_unknown, ERROR_INSTANCE, mf_trim_string(), and error::push_back(). Referenced by mf_process_rsync_io(). Here is the call graph for this function: |
|
Process I/O from the child. While there is I/O to be read, read and parse it. When the end of a line is reached write that line to the log file. If a_finalize is true, the flush the child I/O buffer string. Definition at line 636 of file archiver.cc. References config, execute::err_eof(), execute::err_read(), execute::err_ready(), configuration_manager::io_poll_interval(), logger, configuration_manager::logging_rsync, m_child_pid, m_exec, m_io_err, m_io_out, mf_process_report(), execute::out_eof(), execute::out_read(), execute::out_ready(), prefix(), and log_manager::write(). Referenced by process(). Here is the call graph for this function: |
|
Definition at line 621 of file archiver.cc. References single_job_report::add_report(), m_jpr, and m_jr. Referenced by mf_process_child_io(). Here is the call graph for this function: |
|
Process I/O from rsync. If there is I/O from rsync to be read, read it and then send it through the parser. Definition at line 849 of file archiver.cc. References config, timer::duration_secs(), configuration_manager::io_poll_interval(), m_error_msg, mf_parse_rsync_io(), vault_manager::overflow(), timer::start(), timer::stop(), TRY_nomem, and vaulter. Referenced by mf_do_chores(). Here is the call graph for this function: |
|
Trim off all non-digit leading and trailing characters from a string.
Definition at line 713 of file archiver.cc. Referenced by mf_parse_rsync_io(). |
|
Generate a job prefix string. Create a string to uniquely identify this job to be used in the log file to uniquely identify this job Definition at line 134 of file archiver.cc. References m_job. Referenced by end(), id(), mf_process_child_io(), process(), and start(). |
|
Parent processor for a job. Check for I/O from the child. Check the child's status to see if it's still running, has exited with an exit code, or has exited from a signal. If the child sis not exit normally (i.e. exit from a signal or exit with a non-zero exit code) then check the vault for overflow. If the vault has exceeded it's overflow threshold then that could be the cause for the child's failure, in which case we reschedule the child to be processed again later. If the job is finished (whether successful or not), update the job archiver's status to "completed". Definition at line 300 of file archiver.cc. References execute::child_exit_code(), execute::child_exited_normally(), execute::child_running(), execute::child_signal_no(), execute::child_signaled(), timer::duration(), logger, m_exec, m_status, m_timer, mf_process_child_io(), prefix(), status_completed, status_error, timer::stop(), and log_manager::write(). Here is the call graph for this function: |
|
Return the job report for this job.
Definition at line 360 of file archiver.cc. References m_jr. |
|
Begin processing. Attempt to fork a child process to handle this job. If unsuccessful then retry again later. The child then calls mf_do_chores() to handle the actual processing, while the parent updates the job archiver's status from "pending" to "processing" and begins a timer to measure the duration of the job process. Definition at line 212 of file archiver.cc. References execute::child_pid(), err_unknown, execute::exit(), execute::fork(), job::generate_job_id(), single_job_report::id(), execute::is_child(), logger, m_child_pid, m_exec, m_job, m_jr, m_status, m_success, m_timer, mf_do_chores(), prefix(), execute::reroute_stdio(), timer::start(), status_processing, status_retry_later, error::str(), and log_manager::write(). Here is the call graph for this function: |
|
Return the processing status of this job archiver.
Definition at line 198 of file archiver.cc. References m_status. |
|
Definition at line 67 of file archiver.h. Referenced by clear(), end(), mf_process_child_io(), and start(). |
|
Definition at line 70 of file archiver.h. Referenced by clear(), mf_do_chores(), and mf_process_rsync_io(). |
|
Definition at line 63 of file archiver.h. Referenced by clear(), end(), mf_process_child_io(), process(), and start(). |
|
Definition at line 66 of file archiver.h. Referenced by end(), and mf_process_child_io(). |
|
Definition at line 65 of file archiver.h. Referenced by end(), and mf_process_child_io(). |
|
Definition at line 60 of file archiver.h. Referenced by id(), job_archiver(), mf_do_chores(), prefix(), and start(). |
|
Definition at line 68 of file archiver.h. Referenced by clear(), and mf_process_report(). |
|
Definition at line 69 of file archiver.h. Referenced by clear(), mf_process_report(), report(), and start(). |
|
Definition at line 61 of file archiver.h. Referenced by clear(), end(), job_archiver(), process(), start(), and status(). |
|
Definition at line 64 of file archiver.h. Referenced by clear(), mf_do_chores(), and start(). |
|
Definition at line 62 of file archiver.h. |