Retrieve the current progress information of an ongoing backup operation.
MCO_RET mco_backup_progress_info(
/*IN*/ mco_db_h connection,
/*OUT*/ mco_backup_progress_info_t *pinfo
);
connection
pinfo
mco_backup_progress_info_t structure that will be filled with current backup progress data. May
be NULL if progress information is not needed.This function retrieves real-time progress information about an ongoing backup operation for the specified database. The data is copied from the internal
progress_infofield of the database's backup context (seemco_database_backup_t).The structure contains:
phase— current backup phase (MCO_BACKUP_PROGRESS_IDLE,MCO_BACKUP_PROGRESS_LOOPING, orMCO_BACKUP_PROGRESS_FINALIZING),max_passes— maximum number of passes expected in the current backup cycle,max_steps— total number of steps (e.g., pages to process) in the current pass,pass_no— current pass number (1-based),step_no— current step within the pass.If no backup operation is active,
phasewill beMCO_BACKUP_PROGRESS_IDLEand counters will be zero.Incremental backup must be enabled at database creation time via the
MCO_DB_INCREMENTAL_BACKUP_ENABLEDflag.See Incremental Backup and Restore for more details.
MCO_S_OK
pinfo is NULL).MCO_E_ILLEGAL_PARAM
MCO_E_BACKUP_INVALID_PARAM
MCO_DB_INCREMENTAL_BACKUP_ENABLED flag was not
set at database creation).
{
mco_db_h con;
mco_backup_progress_info_t progress;
MCO_RET rc;
rc = mco_db_connect("mydb", &con);
if (rc != MCO_S_OK) {
/* handle connection error */
}
/* ... */
rc = mco_backup_progress_info(con, &progress);
if (rc == MCO_S_OK && progress.phase != MCO_BACKUP_PROGRESS_IDLE) {
printf("Backup phase: %u, Pass: %llu/%llu, Step: %llu/%llu\n",
(unsigned int)progress.phase,
(unsigned long long)progress.pass_no,
(unsigned long long)progress.max_passes,
(unsigned long long)progress.step_no,
(unsigned long long)progress.max_steps);
}
}