DB_ENV->set_rep_transport |
#include <db.h>int DB_ENV->set_rep_transport(DB_ENV *env, int envid, int (*send)(DB_ENV *dbenv, const DBT *control, const DBT *rec, int envid, u_int32_t flags));
The DB_ENV->set_rep_transport function initializes the communication infrastructure for a database environment participating in a replicated application.
The envid parameter is the local environment's ID. It must be a positive integer and uniquely identify this Berkeley DB database environment (see Replication environment IDs for more information).
The send parameter is a callback interface used to transmit data using the replication application's communication infrastructure. The parameters to send are as follows:
The special identifier DB_EID_BROADCAST indicates that a message should be broadcast to every environment in the replication group. The application may use a true broadcast protocol, or may send the message in sequence to each machine with which it is in communication.
The flags value must be set to 0 or by bitwise inclusively OR'ing together one or more of the following values:
The send interface must return 0 on success and non-zero on failure. If the send interface fails, the message being sent is necessary to maintain database integrity, and the local log is not configured for synchronous flushing, the local log will be flushed; otherwise, any error from the send interface will be ignored.
It may sometimes be useful to pass application-specific data to the send interface; see Environment FAQ for a discussion on how to do this.
The flags parameter is currently unused, and must be set to 0.
The DB_ENV->set_rep_transport function returns a non-zero error value on failure and 0 on success.
The DB_ENV->set_rep_transport function may fail and return a non-zero error for errors specified for other Berkeley DB and C library or system functions. If a catastrophic error has occurred, the DB_ENV->set_rep_transport function may fail and return DB_RUNRECOVERY, in which case all subsequent Berkeley DB calls will fail in the same way.