Berkeley DB Reference Version 5.3.33

DB_ENV->set_backup_callbacks()

#include <db.h>
 
DB_ENV->set_backup_callbacks(DB_ENV, 
        int (*open_func)(DB_ENV *, const char *dbname, 
                         const char *target, void **handle),
        int (*write_func)(DB_ENV *, u_int32_t offset_gbytes, 
                          u_int32_t offset_bytes, u_int32_t size, 
                          u_int8_t *buf, void *handle),
        int (*close_func)(DB_ENV *, const char *dbname, void *handle));  

The DB_ENV->set_backup_callbacks() method configures three callback functions which can be used by the DB_ENV->backup() or DB_ENV->dbbackup() methods to override their default behavior. If one callback is configured, then all three callbacks must be configured. These callbacks are required if the target parameter is set to NULL for the DB_ENV->backup() or DB_ENV->dbbackup() methods.

The DB_ENV->set_backup_callbacks() method configures operations performed using the specified DB_ENV handle, not all operations performed on the underlying database environment.

The DB_ENV->set_backup_callbacks() method may be called at any time during the life of the application.

The DB_ENV->set_backup_callbacks() method returns a non-zero error value on failure and 0 on success.

Parameters

open_func

The open_func parameter is the function used when a target location is opened during a backup. This function should do whatever is necessary to prepare the backup destination for writing the data.

This function takes four parameters:

write_func

The write_func parameter is the function used to write data during a backup. The function takes six parameters:

close_func

The close_func parameter is the function used when ending a backup and closing a backup target. The function takes three parameters:

Class

DB_ENV

See Also

Database Environments and Related Methods, DB_ENV->get_backup_callbacks(), DB_ENV->backup(), and DB_ENV->dbbackup().