Berkeley DB Reference Version 5.3.33

DB_ENV->rep_set_transport()

#include <db.h>

int
DB_ENV->rep_set_transport(DB_ENV *env, int envid,
    int (*send)(DB_ENV *dbenv,
    const DBT *control, const DBT *rec, const DB_LSN *lsnp,
    int envid, u_int32_t flags));  

The DB_ENV->rep_set_transport() method initializes the communication infrastructure for a database environment participating in a replicated application.

The DB_ENV->rep_set_transport() method is not called by most replication applications. It should only be called by Base API applications implementing their own network transport layer, explicitly holding replication group elections and handling replication messages outside of the Replication Manager framework.

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

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

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

Note

Berkeley DB is not re-entrant. The callback function for this method should not attempt to make library calls (for example, to release locks or close open handles). Re-entering Berkeley DB is not guaranteed to work correctly, and the results are undefined.

Parameters

envid

The envid parameter is the local environment's ID. It must be a non-negative integer and uniquely identify this Berkeley DB database environment (see Replication environment IDs for more information).

send

The send callback function is used to transmit data using the replication application's communication infrastructure. The parameters to send are as follows:

It may sometimes be useful to pass application-specific data to the send function; see Environment FAQ for a discussion on how to do this.

The send function must return 0 on success and non-zero on failure. If the send function 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 function will be ignored.

Errors

The DB_ENV->rep_set_transport() method may fail and return one of the following non-zero errors:

EINVAL

The method is called from a Replication Manager application; or an invalid flag value or parameter was specified.

Class

DB_ENV

See Also

Replication and Related Methods