com.sleepycat.je.tree
Class DBIN

java.lang.Object
  extended by com.sleepycat.je.tree.Node
      extended by com.sleepycat.je.tree.IN
          extended by com.sleepycat.je.tree.BIN
              extended by com.sleepycat.je.tree.DBIN
All Implemented Interfaces:
Loggable, java.lang.Comparable<IN>

public final class DBIN
extends BIN
implements Loggable

A DBIN represents an Duplicate Bottom Internal Node in the JE tree.


Field Summary
 
Fields inherited from class com.sleepycat.je.tree.IN
ACCUMULATED_LIMIT, BIN_LEVEL, DBMAP_LEVEL, EXACT_MATCH, INSERT_SUCCESS, latch, LEVEL_MASK, MAIN_LEVEL, MAX_LEVEL, MAY_EVICT_LNS, MAY_EVICT_NODE, MAY_NOT_EVICT, MIN_LEVEL
 
Constructor Summary
DBIN()
           
DBIN(DatabaseImpl db, byte[] identifierKey, int maxEntriesPerNode, byte[] dupKey, int level)
           
 
Method Summary
 java.lang.String beginTag()
           
protected  boolean canBeAncestor(boolean targetContainsDuplicates)
           
protected  long computeMemorySize()
          Count up the memory usage attributable to this node alone.
static long computeOverhead(DbConfigManager configManager)
           
 boolean containsDuplicates()
           
protected  IN createNewInstance(byte[] identifierKey, int maxEntries, int level)
          Create a new DBIN.
 BINReference createReference()
          Create a holder object that encapsulates information about this BIN for the INCompressor.
protected  void dumpLogAdditional(java.lang.StringBuffer sb)
          DBINS need to dump their dup key
 java.lang.String dumpString(int nSpaces, boolean dumpTags)
          For unit test support:
 java.lang.String endTag()
           
protected  int generateLevel(DatabaseId dbId, int newLevel)
           
 byte[] getChildKey(IN child)
          Get the key (dupe or identifier) in child that is used to locate it in 'this' node.
 byte[] getDupKey()
          Return the key for this duplicate set.
 byte[] getDupTreeKey()
          Return the key for navigating through the duplicate tree.
 java.util.Comparator<byte[]> getKeyComparator()
          Return the comparator function to be used for DBINs.
 int getLogSize()
           
 LogEntryType getLogType()
           
 byte[] getMainTreeKey()
          Return the key for navigating through the main tree.
protected  long getMemoryOverhead(MemoryBudget mb)
           
 void readFromLog(java.nio.ByteBuffer itemBuffer, byte entryVersion)
          Initialize this object from the data in itemBuf.
 byte[] selectKey(byte[] mainTreeKey, byte[] dupTreeKey)
           
 java.lang.String shortClassName()
           
 void writeToLog(java.nio.ByteBuffer logBuffer)
          Serialize this object into the buffer.
 
Methods inherited from class com.sleepycat.je.tree.BIN
addCursor, afterLog, beforeLog, clearKnownDeleted, compress, descendOnParentSearch, evictLN, evictLNs, getCursorSet, getLastDeltaVersion, getTreeAdminMemorySize, isCompressible, logDirtyChildren, nCursors, removeCursor, setKnownDeleted, setKnownDeletedLeaveTarget, setProhibitNextDelta, verifyCursors
 
Methods inherited from class com.sleepycat.je.tree.IN
clearLsn, clearPendingDeleted, compareTo, computeArraysOverhead, deleteEntry, dumpLog, equals, fetchTarget, findEntry, getBudgetedMemorySize, getDatabase, getDatabaseId, getDirty, getEntryInMemorySize, getEvictionType, getGeneration, getIdentifierKey, getInListResident, getInMemorySize, getKey, getLastFullVersion, getLevel, getLsn, getMigrate, getNEntries, getRecalcToggle, getState, getTarget, hashCode, init, initMemorySize, insertEntry, insertEntry1, isDbRoot, isEntryKnownDeleted, isEntryPendingDeleted, isEvictable, isKeyInBounds, isLatchOwnerForRead, isLatchOwnerForWrite, isRoot, isSoughtNode, latch, latch, latchNoWait, latchNoWait, latchShared, latchShared, log, log, log, logicalEquals, needsSplitting, optionalLog, optionalLogProvisional, postFetchInit, postRecoveryInit, releaseLatch, releaseLatchIfOwner, setDatabase, setDirty, setEntry, setGeneration, setGeneration, setInListResident, setMigrate, setPendingDeleted, setRecalcToggle, splitInternal, toString, updateEntry, updateEntry, updateEntry, updateMemorySize, updateMemorySize, updateNode, updateNode, updateNode, verify, verifyMemorySize
 
Methods inherited from class com.sleepycat.je.tree.Node
dump, getMemorySizeIncludedByParent, getNodeId, getTransactionId, getType, shortDescription
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.sleepycat.je.log.Loggable
dumpLog, getTransactionId, logicalEquals
 

Constructor Detail

DBIN

public DBIN()

DBIN

public DBIN(DatabaseImpl db,
            byte[] identifierKey,
            int maxEntriesPerNode,
            byte[] dupKey,
            int level)
Method Detail

createNewInstance

protected IN createNewInstance(byte[] identifierKey,
                               int maxEntries,
                               int level)
Create a new DBIN. Need this because we can't call newInstance() without getting a 0 node.

Overrides:
createNewInstance in class BIN

generateLevel

protected int generateLevel(DatabaseId dbId,
                            int newLevel)
Overrides:
generateLevel in class IN

getKeyComparator

public final java.util.Comparator<byte[]> getKeyComparator()
Return the comparator function to be used for DBINs. This is the user defined duplicate comparison function, if defined.

Overrides:
getKeyComparator in class BIN

getDupKey

public byte[] getDupKey()
Return the key for this duplicate set.

Overrides:
getDupKey in class IN

getChildKey

public byte[] getChildKey(IN child)
                   throws DatabaseException
Get the key (dupe or identifier) in child that is used to locate it in 'this' node.

Overrides:
getChildKey in class BIN
Throws:
DatabaseException

selectKey

public byte[] selectKey(byte[] mainTreeKey,
                        byte[] dupTreeKey)
Overrides:
selectKey in class IN

getDupTreeKey

public byte[] getDupTreeKey()
Return the key for navigating through the duplicate tree.

Overrides:
getDupTreeKey in class IN

getMainTreeKey

public byte[] getMainTreeKey()
Return the key for navigating through the main tree.

Overrides:
getMainTreeKey in class IN

containsDuplicates

public boolean containsDuplicates()
Overrides:
containsDuplicates in class Node
Returns:
true if this node is a duplicate-bearing node type, false if otherwise.

createReference

public BINReference createReference()
Description copied from class: BIN
Create a holder object that encapsulates information about this BIN for the INCompressor.

Overrides:
createReference in class BIN

computeMemorySize

protected long computeMemorySize()
Count up the memory usage attributable to this node alone.

Overrides:
computeMemorySize in class IN

computeOverhead

public static long computeOverhead(DbConfigManager configManager)
                            throws DatabaseException
Throws:
DatabaseException

getMemoryOverhead

protected long getMemoryOverhead(MemoryBudget mb)
Overrides:
getMemoryOverhead in class BIN

canBeAncestor

protected boolean canBeAncestor(boolean targetContainsDuplicates)
Overrides:
canBeAncestor in class BIN
Returns:
true if you can be the ancestor of the target IN. Currently the determining factor is whether the target IN contains duplicates.

beginTag

public java.lang.String beginTag()
Overrides:
beginTag in class BIN

endTag

public java.lang.String endTag()
Overrides:
endTag in class BIN

dumpString

public java.lang.String dumpString(int nSpaces,
                                   boolean dumpTags)
For unit test support:

Overrides:
dumpString in class IN
Returns:
a string that dumps information about this IN, without

getLogType

public LogEntryType getLogType()
Overrides:
getLogType in class BIN
See Also:
Node.getLogType()

getLogSize

public int getLogSize()
Specified by:
getLogSize in interface Loggable
Overrides:
getLogSize in class IN
Returns:
number of bytes used to store this object.
See Also:
Loggable.getLogSize()

writeToLog

public void writeToLog(java.nio.ByteBuffer logBuffer)
Description copied from interface: Loggable
Serialize this object into the buffer.

Specified by:
writeToLog in interface Loggable
Overrides:
writeToLog in class IN
Parameters:
logBuffer - is the destination buffer
See Also:
Loggable.writeToLog(java.nio.ByteBuffer)

readFromLog

public void readFromLog(java.nio.ByteBuffer itemBuffer,
                        byte entryVersion)
                 throws LogException
Description copied from interface: Loggable
Initialize this object from the data in itemBuf.

Specified by:
readFromLog in interface Loggable
Overrides:
readFromLog in class IN
Throws:
LogException
See Also:
IN.readFromLog(java.nio.ByteBuffer, byte)

dumpLogAdditional

protected void dumpLogAdditional(java.lang.StringBuffer sb)
DBINS need to dump their dup key

Overrides:
dumpLogAdditional in class IN

shortClassName

public java.lang.String shortClassName()
Overrides:
shortClassName in class BIN