com.sleepycat.je.tree
Class DBIN

java.lang.Object
  extended bycom.sleepycat.je.tree.Node
      extended bycom.sleepycat.je.tree.IN
          extended bycom.sleepycat.je.tree.BIN
              extended bycom.sleepycat.je.tree.DBIN
All Implemented Interfaces:
Comparable, LoggableObject, LogReadable, LogWritable

public final class DBIN
extends BIN
implements LoggableObject

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


Field Summary
 
Fields inherited from class com.sleepycat.je.tree.BIN
cursorSet
 
Fields inherited from class com.sleepycat.je.tree.IN
DBMAP_LEVEL, evictionProhibited, EXACT_MATCH, INSERT_SUCCESS, MAIN_LEVEL, MAX_LEVEL, MIN_LEVEL
 
Constructor Summary
DBIN()
           
DBIN(DatabaseImpl db, Key identifierKey, int maxEntriesPerNode, Key dupKey, int level)
           
 
Method Summary
(package private)  void accumulateStats(TreeWalkerStatsAccumulator acc)
           
 String beginTag()
           
protected  boolean canBeAncestor(boolean targetContainsDuplicates)
           
protected  boolean childrenAreEvictable()
           
static long computeOverhead(DbConfigManager configManager)
           
 boolean containsDuplicates()
           
protected  IN createNewInstance(Key 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(StringBuffer sb)
          DBINS need to dump their dup key
 String dumpString(int nSpaces, boolean dumpTags)
          For unit test support:
 String endTag()
           
protected  int generateLevel(DatabaseId dbId, int newLevel)
           
 LogEntryType getBINDeltaType()
           
 Key getChildKey(IN child)
          Get the key (dupe or identifier) in child that is used to locate it in 'this' node.
(package private)  BIN getCursorBIN(CursorImpl cursor)
          The following four methods access the correct fields in a cursor depending on whether "this" is a BIN or DBIN.
(package private)  int getCursorIndex(CursorImpl cursor)
           
 Key getDupKey()
          Return the key for this duplicate set.
 Key getDupTreeKey()
          Return the key for navigating through the duplicate tree.
 Comparator getKeyComparator()
          Return the comparator function to be used for DBINs.
 int getLogSize()
           
 LogEntryType getLogType()
          All objects that are reponsible for a generating a type of log entry must implement this.
 Key getMainTreeKey()
          Return the key for navigating through the main tree.
protected  long getMemoryOverhead(MemoryBudget mb)
           
(package private)  boolean matchLNByNodeId(TreeLocation location, long nodeId)
           
 void readFromLog(ByteBuffer itemBuffer)
          Initialize this object from the data in itemBuf.
 Key selectKey(Key mainTreeKey, Key dupTreeKey)
           
(package private)  void setCursorBIN(CursorImpl cursor, BIN bin)
           
(package private)  void setCursorIndex(CursorImpl cursor, int index)
           
 String shortClassName()
           
 void writeToLog(ByteBuffer logBuffer)
          Serialize this object into the buffer.
 
Methods inherited from class com.sleepycat.je.tree.BIN
addCursor, adjustCursors, adjustCursorsForInsert, adjustCursorsForMutation, clearKnownDeleted, compress, descendOnParentSearch, entryZeroKeyComparesLow, evictLNs, getCursorSet, getLastDeltaVersion, isEvictable, isValidForDelete, logInternal, nCursors, removeCursor, setCleanedSinceLastLog, setCompressedSinceLastLog, setKnownDeleted, setKnownDeletedLeaveTarget, splitSpecial, validateSubtreeBeforeDelete, verifyCursors
 
Methods inherited from class com.sleepycat.je.tree.IN
accountForSubtreeRemoval, clearTarget, compareTo, computeMemorySize, deleteEntry, deleteEntry, dumpKeys, dumpLog, equals, fetchTarget, fetchTargetIgnoreKnownDeleted, findEntry, findParent, getDatabase, getDatabaseId, getDirty, getGeneration, getIdentifierKey, getInMemorySize, getInMemorySize, getInMemorySize, getKey, getLastFullVersion, getLatch, getLevel, getLsn, getMaxEntries, getNEntries, getState, getTarget, getTransactionId, hashCode, init, initMemorySize, insertEntry, insertEntry1, isDbRoot, isDirty, isEntryKnownDeleted, isKeyInBounds, isRoot, isSoughtNode, latch, log, log, logAllowDeltas, logEntryIsTransactional, logProvisional, makeFetchErrorMsg, makePrefixKey, needsSplitting, postFetchInit, postRecoveryInit, rebuildINList, releaseLatch, setDatabase, setDirty, setEntry, setEvictionProhibited, setGeneration, setGeneration, setIdentifierKey, setInListResident, setIsRoot, setLastFullLsn, setLsn, setTarget, split, splitInternal, toString, traceSplit, updateEntry, updateEntry, updateEntry, updateEntry, updateEntry, updateMemorySize, updateMemorySize, updateMemorySize, verify, verifyMemorySize
 
Methods inherited from class com.sleepycat.je.tree.Node
dump, getLastId, getMemorySizeIncludedByParent, getNextNodeId, getNodeId, getType, marshallOutsideWriteLatch, postLogWork, setLastNodeId, setNodeId, shortDescription
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.sleepycat.je.log.LoggableObject
marshallOutsideWriteLatch, postLogWork
 

Constructor Detail

DBIN

public DBIN()

DBIN

public DBIN(DatabaseImpl db,
            Key identifierKey,
            int maxEntriesPerNode,
            Key dupKey,
            int level)
Method Detail

createNewInstance

protected IN createNewInstance(Key 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 Comparator 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 Key getDupKey()
Return the key for this duplicate set.

Overrides:
getDupKey in class IN

getChildKey

public Key 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 Key selectKey(Key mainTreeKey,
                     Key dupTreeKey)
Overrides:
selectKey in class IN

getDupTreeKey

public Key getDupTreeKey()
Return the key for navigating through the duplicate tree.

Overrides:
getDupTreeKey in class IN

getMainTreeKey

public Key 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.

getBINDeltaType

public LogEntryType getBINDeltaType()
Overrides:
getBINDeltaType in class BIN
Returns:
the log entry type to use for bin delta log entries.

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

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

childrenAreEvictable

protected boolean childrenAreEvictable()
Overrides:
childrenAreEvictable in class BIN

getCursorBIN

BIN getCursorBIN(CursorImpl cursor)
The following four methods access the correct fields in a cursor depending on whether "this" is a BIN or DBIN. For BIN's, the CursorImpl.index and CursorImpl.bin fields should be used. For DBIN's, the CursorImpl.dupIndex and CursorImpl.dupBin fields should be used.

Overrides:
getCursorBIN in class BIN

getCursorIndex

int getCursorIndex(CursorImpl cursor)
Overrides:
getCursorIndex in class BIN

setCursorBIN

void setCursorBIN(CursorImpl cursor,
                  BIN bin)
Overrides:
setCursorBIN in class BIN

setCursorIndex

void setCursorIndex(CursorImpl cursor,
                    int index)
Overrides:
setCursorIndex in class BIN

matchLNByNodeId

boolean matchLNByNodeId(TreeLocation location,
                        long nodeId)
                  throws DatabaseException
Overrides:
matchLNByNodeId in class Node
Throws:
DatabaseException

accumulateStats

void accumulateStats(TreeWalkerStatsAccumulator acc)
Overrides:
accumulateStats in class BIN

beginTag

public String beginTag()
Overrides:
beginTag in class BIN

endTag

public String endTag()
Overrides:
endTag in class BIN

dumpString

public 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()
Description copied from interface: LoggableObject
All objects that are reponsible for a generating a type of log entry must implement this.

Specified by:
getLogType in interface LoggableObject
Overrides:
getLogType in class BIN
See Also:
LoggableObject.getLogType()

getLogSize

public int getLogSize()
Specified by:
getLogSize in interface LogWritable
Overrides:
getLogSize in class IN
See Also:
LogWritable.getLogSize()

writeToLog

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

Specified by:
writeToLog in interface LogWritable
Overrides:
writeToLog in class IN
See Also:
LogWritable.writeToLog(java.nio.ByteBuffer)

readFromLog

public void readFromLog(ByteBuffer itemBuffer)
                 throws LogException
Description copied from interface: LogReadable
Initialize this object from the data in itemBuf.

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

dumpLogAdditional

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

Overrides:
dumpLogAdditional in class IN

shortClassName

public String shortClassName()
Overrides:
shortClassName in class BIN


Copyright 2004 Sleepycat, Inc. All Rights Reserved.