Berkeley DB: DbEnv.set_rep_transport
Description: Berkeley DB: An embedded database programmatic toolkit.
Keywords: embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++

# DbEnv.set_rep_transport |

`

###

    import com.sleepycat.db.*;

    public interface DbEnvSend
    {
        public abstract int db_send(DB_ENV *dbenv,
          const Dbt *control, const Dbt *rec, int envid, int flags);
    }
    public class DbEnv
    {
        public int set_rep_transport(DbEnvSend db_send)
    	throws DbException;
        ...
    }

# Description

The DbEnv.set_rep_transport method 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:

dbenv
  The enclosing database environment.

control
  The control parameter is the first of the two data elements to be transmitted by the send interface.

rec
  The rec parameter is the second of the two data elements to be transmitted by the send interface.

envid
  The envid parameter is a positive integer identifier that specifies the replication environment to which the message should be sent (see Replication environment IDs for more information).

  The special identifier Db.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.

flags

  The flags value must be set to 0 or by bitwise inclusively OR'ing together one or more of the following values:

  Db.DB_REP_PERMANENT
    The record being sent is critical for maintaining database integrity (for example, the message includes a transaction commit). The application should take appropriate action to enforce the reliability guarantees it has chosen, such as waiting for acknowledgement from one or more clients.

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 DbEnv.set_rep_transport method configures operations performed using the specified DbEnv handle, not all operations performed on the underlying database environment.

The DbEnv.set_rep_transport interface may be called at any time during the life of the application.

The DbEnv.set_rep_transport method throws an exception that encapsulates a non-zero error value on failure.

# Errors

The DbEnv.set_rep_transport method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. If a catastrophic error has occurred, the DbEnv.set_rep_transport method may fail and throw a DbRunRecoveryException, in which case all subsequent Berkeley DB calls will fail in the same way.

# Class

DbEnv

# See Also

Replication and Related Methods`

Copyright Sleepycat Software