Start the asynchronous backup process.
MCO_RET mco_async_backup_start(
/*IN*/ mco_db_h connection,
/*IN*/ unsigned int backup_cycle_delay_msec,
/*IN*/ const char *file_name,
/*IN*/ const char *label,
/*IN*/ mco_backup_type type,
/*IN*/ int compression_level,
/*IN*/ const char *cipher
);
connection
backup_cycle_delay_msec
file_name
label
"mylabel00001").
If NULL, records are named "AUTOBACKUP#####".type
typedef enum {
MCO_BACKUP_TYPE_AUTO,
MCO_BACKUP_TYPE_SNAPSHOT,
MCO_BACKUP_TYPE_INCREMENTAL
} mco_backup_type;
compression_level
cipher
NULL for unencrypted backups.This function starts a background thread that periodically creates backup records according to the specified parameters. It stores the backup cycle context in the database header and establishes its own internal database connection (which does not include a sniffer context).
Only one asynchronous backup or restore operation can run per database at a time.
See Incremental Backup and Restore for more details.
MCO_S_OK
MCO_E_BACKUP
MCO_E_ILLEGAL_PARAM
type, negative delay, etc.).MCO_ERR_DB_NOMEM_HEAP
{
const char *db_name = "myDb";
mco_db_h con;
MCO_RET rc;
rc = mco_db_connect(db_name, &con);
if (rc != MCO_S_OK) {
/* handle connection error */
}
rc = mco_async_backup_start(
con,
500, // backup every 500 ms
"file.backup",
"label", // → "label00001", "label00002", ...
MCO_BACKUP_TYPE_AUTO,
0, // no compression
NULL // no encryption
);
if (rc != MCO_S_OK) {
/* handle backup start error */
}
}