mco_async_restore_start

Start the asynchronous restore process.

For an overview see page Incremental Online Backup in C

Prototype

    MCO_RET mco_async_restore_start(
        /*IN*/ mco_db_h connection,
        /*IN*/ const char *file_name,
        /*IN*/ const char *label,
        /*IN*/ const char *cipher
    );

Arguments

connection
Database connection handle for the target database to be restored.
file_name
Name of the backup file from which to restore data.
label
Label of the backup point to restore (inclusive). The restore applies all records from the latest snapshot up to this label.
cipher
Optional decryption key if the backup is encrypted. May be NULL for unencrypted backups.

Description

This function initiates a background task that restores the database from the specified backup file and label. The restore operation runs in a separate thread and establishes its own internal database connection (which does not include a sniffer context).

Only one asynchronous backup or restore operation can be active per database at a time.

See Incremental Backup and Restore for more details.

Return Codes

MCO_S_OK
Asynchronous restore process started successfully.
MCO_E_BACKUP
Another backup or restore operation is already active, or the restore thread could not be created.
MCO_E_ILLEGAL_PARAM
One or more input parameters are invalid (e.g., NULL file name, missing label, etc.).
MCO_ERR_DB_NOMEM_HEAP
Insufficient space in the database heap to store the restore context.

Example

    {
        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_restore_start(
            con,
            "file.backup",
            "v1.2",      // restore up to this label
            NULL         // no encryption
        );
        if (rc != MCO_S_OK) {
            /* handle restore start error */
        }
    }

Files

Header file:
mco.h
Source file:
mcobackup.c
Library:
libmcobackup.a