com.sleepycat.je
Class SecondaryDatabase

java.lang.Object
  extended by com.sleepycat.je.Database
      extended by com.sleepycat.je.SecondaryDatabase

public class SecondaryDatabase
extends Database

Javadoc for this public class is generated via the doc templates in the doc_src directory.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.sleepycat.je.Database
Database.DbState
 
Field Summary
 
Fields inherited from class com.sleepycat.je.Database
CLOSED, configuration, envHandle, handleLocker, INVALID, OPEN
 
Constructor Summary
SecondaryDatabase(Environment env, SecondaryConfig secConfig, Database primaryDatabase)
          Creates a secondary database but does not open or fully initialize it.
 
Method Summary
(package private)  void clearForeignKeyTrigger()
          Should be called by the foreignKeyTrigger while holding a write lock on the trigger list.
(package private)  void clearPrimary()
          Should be called by the secondaryTrigger while holding a write lock on the trigger list.
 void close()
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
 OperationStatus delete(Transaction txn, DatabaseEntry key)
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
 OperationStatus get(Transaction txn, DatabaseEntry key, DatabaseEntry pKey, DatabaseEntry data, LockMode lockMode)
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
 OperationStatus get(Transaction txn, DatabaseEntry key, DatabaseEntry data, LockMode lockMode)
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
 Database getPrimaryDatabase()
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
 SecondaryConfig getPrivateSecondaryConfig()
          Returns the secondary config without cloning, for internal use.
 OperationStatus getSearchBoth(Transaction txn, DatabaseEntry key, DatabaseEntry pKey, DatabaseEntry data, LockMode lockMode)
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
 OperationStatus getSearchBoth(Transaction txn, DatabaseEntry key, DatabaseEntry data, LockMode lockMode)
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
 SecondaryConfig getSecondaryConfig()
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
(package private)  void initExisting(Environment env, Locker locker, DatabaseImpl database, DatabaseConfig dbConfig)
          Open a database, called by Environment
(package private)  void initNew(Environment env, Locker locker, String databaseName, DatabaseConfig dbConfig)
          Create a database, called by Environment
 JoinCursor join(Cursor[] cursors, JoinConfig config)
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
(package private)  Cursor newDbcInstance(Transaction txn, CursorConfig cursorConfig)
          Overrides Database method.
(package private) static UnsupportedOperationException notAllowedException()
           
(package private)  void onForeignKeyDelete(Locker locker, DatabaseEntry secKey)
          Called by the ForeignKeyTrigger when a record in the foreign database is deleted.
 SecondaryCursor openSecondaryCursor(Transaction txn, CursorConfig cursorConfig)
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
 OperationStatus put(Transaction txn, DatabaseEntry key, DatabaseEntry data)
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
 OperationStatus putNoDupData(Transaction txn, DatabaseEntry key, DatabaseEntry data)
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
 OperationStatus putNoOverwrite(Transaction txn, DatabaseEntry key, DatabaseEntry data)
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
(package private)  DatabaseException secondaryCorruptException()
           
(package private)  void trace(Level level, String methodName)
          Send trace messages to the java.util.logger.
 int truncate(Transaction txn, boolean countRecords)
          Deprecated.  
(package private)  void updateSecondary(Locker locker, Cursor cursor, DatabaseEntry priKey, DatabaseEntry oldData, DatabaseEntry newData)
          Updates a single secondary when a put() or delete() is performed on the primary.
 
Methods inherited from class com.sleepycat.je.Database
addCursor, addTrigger, checkEnv, checkProhibitedDbState, checkRequiredDbState, deleteInternal, getConfig, getDatabaseImpl, getDatabaseName, getDebugName, getEnvironment, getSecondaryDatabases, getStats, hasTriggers, invalidate, isTransactional, isWritable, notifyTriggers, openCursor, openSequence, preload, preload, putInternal, removeCursor, removeSequence, removeTrigger, setHandleLocker, trace, trace, truncateInternal, verify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SecondaryDatabase

SecondaryDatabase(Environment env,
                  SecondaryConfig secConfig,
                  Database primaryDatabase)
            throws DatabaseException
Creates a secondary database but does not open or fully initialize it.

Throws:
DatabaseException
Method Detail

initNew

void initNew(Environment env,
             Locker locker,
             String databaseName,
             DatabaseConfig dbConfig)
       throws DatabaseException
Create a database, called by Environment

Overrides:
initNew in class Database
Throws:
DatabaseException

initExisting

void initExisting(Environment env,
                  Locker locker,
                  DatabaseImpl database,
                  DatabaseConfig dbConfig)
            throws DatabaseException
Open a database, called by Environment

Overrides:
initExisting in class Database
Throws:
DatabaseException

close

public void close()
           throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Overrides:
close in class Database
Throws:
DatabaseException

clearPrimary

void clearPrimary()
Should be called by the secondaryTrigger while holding a write lock on the trigger list.


clearForeignKeyTrigger

void clearForeignKeyTrigger()
Should be called by the foreignKeyTrigger while holding a write lock on the trigger list.


getPrimaryDatabase

public Database getPrimaryDatabase()
                            throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Throws:
DatabaseException

getSecondaryConfig

public SecondaryConfig getSecondaryConfig()
                                   throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Throws:
DatabaseException

getPrivateSecondaryConfig

public SecondaryConfig getPrivateSecondaryConfig()
Returns the secondary config without cloning, for internal use.


openSecondaryCursor

public SecondaryCursor openSecondaryCursor(Transaction txn,
                                           CursorConfig cursorConfig)
                                    throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Throws:
DatabaseException

newDbcInstance

Cursor newDbcInstance(Transaction txn,
                      CursorConfig cursorConfig)
                throws DatabaseException
Overrides Database method.

Overrides:
newDbcInstance in class Database
Throws:
DatabaseException

delete

public OperationStatus delete(Transaction txn,
                              DatabaseEntry key)
                       throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Overrides:
delete in class Database
Throws:
DatabaseException

get

public OperationStatus get(Transaction txn,
                           DatabaseEntry key,
                           DatabaseEntry data,
                           LockMode lockMode)
                    throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Overrides:
get in class Database
Throws:
DatabaseException

get

public OperationStatus get(Transaction txn,
                           DatabaseEntry key,
                           DatabaseEntry pKey,
                           DatabaseEntry data,
                           LockMode lockMode)
                    throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Throws:
DatabaseException

getSearchBoth

public OperationStatus getSearchBoth(Transaction txn,
                                     DatabaseEntry key,
                                     DatabaseEntry data,
                                     LockMode lockMode)
                              throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Overrides:
getSearchBoth in class Database
Throws:
DatabaseException

getSearchBoth

public OperationStatus getSearchBoth(Transaction txn,
                                     DatabaseEntry key,
                                     DatabaseEntry pKey,
                                     DatabaseEntry data,
                                     LockMode lockMode)
                              throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Throws:
DatabaseException

put

public OperationStatus put(Transaction txn,
                           DatabaseEntry key,
                           DatabaseEntry data)
                    throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Overrides:
put in class Database
Throws:
DatabaseException

putNoOverwrite

public OperationStatus putNoOverwrite(Transaction txn,
                                      DatabaseEntry key,
                                      DatabaseEntry data)
                               throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Overrides:
putNoOverwrite in class Database
Throws:
DatabaseException

putNoDupData

public OperationStatus putNoDupData(Transaction txn,
                                    DatabaseEntry key,
                                    DatabaseEntry data)
                             throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Overrides:
putNoDupData in class Database
Throws:
DatabaseException

join

public JoinCursor join(Cursor[] cursors,
                       JoinConfig config)
                throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Overrides:
join in class Database
Throws:
DatabaseException

truncate

public int truncate(Transaction txn,
                    boolean countRecords)
             throws DatabaseException
Deprecated. 

Javadoc for this public method is generated via the doc templates in the doc_src directory.

Overrides:
truncate in class Database
Throws:
DatabaseException

updateSecondary

void updateSecondary(Locker locker,
                     Cursor cursor,
                     DatabaseEntry priKey,
                     DatabaseEntry oldData,
                     DatabaseEntry newData)
               throws DatabaseException
Updates a single secondary when a put() or delete() is performed on the primary.

Parameters:
locker - the internal locker.
cursor - secondary cursor to use, or null if this method should open and close a cursor if one is needed.
priKey - the primary key.
oldData - the primary data before the change, or null if the record did not previously exist.
newData - the primary data after the change, or null if the record has been deleted.
Throws:
DatabaseException

onForeignKeyDelete

void onForeignKeyDelete(Locker locker,
                        DatabaseEntry secKey)
                  throws DatabaseException
Called by the ForeignKeyTrigger when a record in the foreign database is deleted.

Parameters:
secKey - is the primary key of the foreign database, which is the secondary key (ordinary key) of this secondary database.
Throws:
DatabaseException

secondaryCorruptException

DatabaseException secondaryCorruptException()
                                      throws DatabaseException
Throws:
DatabaseException

notAllowedException

static UnsupportedOperationException notAllowedException()

trace

void trace(Level level,
           String methodName)
     throws DatabaseException
Send trace messages to the java.util.logger. Don't rely on the logger alone to conditionalize whether we send this message, we don't even want to construct the message if the level is not enabled.

Throws:
DatabaseException


Copyright 2004-2005 Sleepycat, Inc. All Rights Reserved.