com.sleepycat.je.dbi
Interface ReplicatorInstance


public interface ReplicatorInstance

The ReplicatorInstance is the sole conduit of replication functionality available to the core JE code. All references to any classes from com.sleepycat.je.rep* should be funnelled through this interface. Keeping a strict boundary serves to maintain the reliability of the standalone node. All ReplicatorInstance methods are prohibited from blocking, and should be examine carefully to determine whether they can throw exceptions or have any side effects which would diminish the reliability of the non-replication code paths. The ReplicatorInstance also allows us to package JE without the additional replication classes.


Method Summary
 VLSN bumpVLSN()
          Increment and get the next VLSN.
 Txn createRepTxn(EnvironmentImpl envImpl, TransactionConfig config)
          Create an appropriate type of Replicated transaction.
 Txn createRepTxn(EnvironmentImpl envImpl, TransactionConfig config, boolean noAPIReadLock, long mandatedId)
          A form used primarily for auto commit transactions.
 Txn createRepTxn(EnvironmentImpl envImpl, TransactionConfig config, ReplicationContext repContext)
          A variation of the above used for testing; it arranges for a ReplicationContext to be passed in for testing purposes.
 void decrementVLSN()
          Decrement the vlsn if there was a problem logging the entry
 boolean isMaster()
           
 void preCheckpointEndFlush()
          Do any work that must be included as part of the checkpoint process.
 void registerVLSN(long lsn, LogEntryHeader header)
          Record the vlsn->lsn mapping for this just-logged log entry.
 

Method Detail

registerVLSN

void registerVLSN(long lsn,
                  LogEntryHeader header)
Record the vlsn->lsn mapping for this just-logged log entry. This method is synchronized on the VLSNMap, and must be called outside the log write latch.

Parameters:
lsn - lsn of the target log entry
header - of the target log entry, which contains the VLSN and log entry type.

bumpVLSN

VLSN bumpVLSN()
Increment and get the next VLSN.


decrementVLSN

void decrementVLSN()
Decrement the vlsn if there was a problem logging the entry


isMaster

boolean isMaster()
Returns:
true if this node is the replication master.

preCheckpointEndFlush

void preCheckpointEndFlush()
                           throws DatabaseException
Do any work that must be included as part of the checkpoint process.

Throws:
DatabaseException - if any activity fails

createRepTxn

Txn createRepTxn(EnvironmentImpl envImpl,
                 TransactionConfig config)
                 throws DatabaseException
Create an appropriate type of Replicated transaction. Specifically, it creates a MasterTxn, if the node is currently a Master, a ReadonlyTxn otherwise, that is, if the node is a Replica, or it's currently in a DETACHED state. Note that a ReplicaTxn, used for transaction replay on a Replica is not created on this path. It's created explicitly in the Replay loop by a Replica.

Parameters:
envImpl - the environment associated with the transaction
config - the transaction configuration
Returns:
an instance of MasterTxn or ReadonlyTxn
Throws:
DatabaseException

createRepTxn

Txn createRepTxn(EnvironmentImpl envImpl,
                 TransactionConfig config,
                 boolean noAPIReadLock,
                 long mandatedId)
                 throws DatabaseException
A form used primarily for auto commit transactions.

Throws:
DatabaseException
See Also:
(com.sleepycat.je.dbi.EnvironmentImpl, com.sleepycat.je.TransactionConfig, boolean, long)

createRepTxn

Txn createRepTxn(EnvironmentImpl envImpl,
                 TransactionConfig config,
                 ReplicationContext repContext)
                 throws DatabaseException
A variation of the above used for testing; it arranges for a ReplicationContext to be passed in for testing purposes.

Throws:
DatabaseException