com.sleepycat.je.tree
Class DIN

java.lang.Object
  extended by com.sleepycat.je.tree.Node
      extended by com.sleepycat.je.tree.IN
          extended by com.sleepycat.je.tree.DIN
All Implemented Interfaces:
LoggableObject, LogReadable, LogWritable, Comparable

public final class DIN
extends IN

An DIN represents an Duplicate Internal Node in the JE tree.


Field Summary
 
Fields inherited from class com.sleepycat.je.tree.IN
ACCUMULATED_LIMIT, DBMAP_LEVEL, EXACT_MATCH, INSERT_SUCCESS, LEVEL_MASK, MAIN_LEVEL, MAX_LEVEL, MAY_EVICT_LNS, MAY_EVICT_NODE, MAY_NOT_EVICT, MIN_LEVEL
 
Constructor Summary
DIN()
          Create an empty DIN, with no node id, to be filled in from the log.
DIN(DatabaseImpl db, byte[] identifierKey, int capacity, byte[] dupKey, ChildReference dupCountLNRef, int level)
          Create a new DIN.
 
Method Summary
(package private)  void accumulateStats(TreeWalkerStatsAccumulator acc)
           
 String beginTag()
           
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 DIN.
protected  void dumpLogAdditional(StringBuffer sb)
          DINS 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)
           
 byte[] getChildKey(IN child)
          Get the key (dupe or identifier) in child that is used to locate it in 'this' node.
 DupCountLN getDupCountLN()
           
 ChildReference getDupCountLNRef()
           
 byte[] getDupKey()
          Return the key for this duplicate set.
 byte[] getDupTreeKey()
          Return the key for navigating through the duplicate tree.
 Comparator getKeyComparator()
          Return the comparator function to be used for DINs.
 int getLogSize()
           
 LogEntryType getLogType()
          All objects that are reponsible for a generating a type of log entry must implement this.
 byte[] getMainTreeKey()
          Return the key for navigating through the main tree.
protected  long getMemoryOverhead(MemoryBudget mb)
           
(package private)  void incrementDuplicateCount(EnvironmentImpl env, LockResult lockResult, byte[] key, Locker locker)
           
 boolean isDbRoot()
           
(package private)  boolean matchLNByNodeId(TreeLocation location, long nodeId)
           
 void readFromLog(ByteBuffer itemBuffer, byte entryTypeVersion)
          Initialize this object from the data in itemBuf.
 byte[] selectKey(byte[] mainTreeKey, byte[] dupTreeKey)
           
(package private)  void setDupCountLN(ChildReference dupCountLNRef)
          Assign the Dup Count LN.
 String shortClassName()
           
 String toString()
          Default toString method at the root of the tree.
 void updateDupCountLN(Node target)
          Assign the Dup Count LN node.
 void updateDupCountLNRef(long newLsn)
          Update dup count LSN.
 void updateDupCountLNRefAndNullTarget(long newLsn)
          Update Dup Count LN.
 void writeToLog(ByteBuffer logBuffer)
          Serialize this object into the buffer.
 
Methods inherited from class com.sleepycat.je.tree.IN
accountForSubtreeRemoval, adjustCursors, adjustCursorsForInsert, canBeAncestor, clearKnownDeleted, clearPendingDeleted, compareTo, compress, computeArraysOverhead, deleteEntry, deleteEntry, descendOnParentSearch, dumpDeletedState, dumpKeys, dumpLog, entryZeroKeyComparesLow, equals, fetchTarget, findEntry, findParent, flushProvisionalObsolete, getAccumulatedDelta, getChildEvictionType, getDatabase, getDatabaseId, getDirty, getEntryInMemorySize, getEntryLsnByteArray, getEntryLsnLongArray, getEvictionType, getGeneration, getIdentifierKey, getInMemorySize, getKey, getLastFullVersion, getLevel, getLsn, getMaxEntries, getMigrate, getNEntries, getState, getTarget, getTransactionId, hashCode, hasNonLNChildren, init, initEntryLsn, initMemorySize, insertEntry, insertEntry1, isCompressible, isDirty, isEntryKnownDeleted, isEntryPendingDeleted, isEvictable, isEvictionProhibited, isKeyInBounds, isLatchOwner, isRoot, isSoughtNode, isStateKnownDeleted, isStatePendingDeleted, isValidForDelete, latch, latch, latchNoWait, latchNoWait, log, log, log, logEntryIsTransactional, logInternal, logProvisional, makeFetchErrorMsg, needsSplitting, postFetchInit, postRecoveryInit, rebuildINList, releaseLatch, releaseLatchIfOwner, setCleanedSinceLastLog, setCompressedSinceLastLog, setDatabase, setDirty, setEntry, setGeneration, setGeneration, setIdentifierKey, setInListResident, setIsRoot, setKnownDeleted, setLastFullLsn, setLsn, setLsnElement, setMigrate, setPendingDeleted, setTarget, split, splitInternal, splitSpecial, trackProvisionalObsolete, updateEntry, updateEntry, updateEntry, updateEntry, updateEntry, updateEntry, updateMemorySize, updateMemorySize, updateMemorySize, validateSubtreeBeforeDelete, verify, verifyMemorySize
 
Methods inherited from class com.sleepycat.je.tree.Node
countAsObsoleteWhenLogged, 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
countAsObsoleteWhenLogged, marshallOutsideWriteLatch, postLogWork
 

Constructor Detail

DIN

public DIN()
Create an empty DIN, with no node id, to be filled in from the log.


DIN

public DIN(DatabaseImpl db,
           byte[] identifierKey,
           int capacity,
           byte[] dupKey,
           ChildReference dupCountLNRef,
           int level)
Create a new DIN.

Method Detail

generateLevel

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

createNewInstance

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

Overrides:
createNewInstance in class IN

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 IN
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

getDupCountLNRef

public ChildReference getDupCountLNRef()

getDupCountLN

public DupCountLN getDupCountLN()
                         throws DatabaseException
Throws:
DatabaseException

setDupCountLN

void setDupCountLN(ChildReference dupCountLNRef)
Assign the Dup Count LN.


updateDupCountLN

public void updateDupCountLN(Node target)
Assign the Dup Count LN node. Does not dirty the DIN.


updateDupCountLNRefAndNullTarget

public void updateDupCountLNRefAndNullTarget(long newLsn)
Update Dup Count LN.


updateDupCountLNRef

public void updateDupCountLNRef(long newLsn)
Update dup count LSN.


containsDuplicates

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

isDbRoot

public boolean isDbRoot()
Overrides:
isDbRoot in class IN

getKeyComparator

public final Comparator getKeyComparator()
Return the comparator function to be used for DINs. This is the user defined duplicate comparison function, if defined.

Overrides:
getKeyComparator in class IN

incrementDuplicateCount

void incrementDuplicateCount(EnvironmentImpl env,
                             LockResult lockResult,
                             byte[] key,
                             Locker locker)
                       throws DatabaseException
Throws:
DatabaseException

computeMemorySize

protected long computeMemorySize()
Count up the memory usage attributable to this node alone. LNs children are counted by their BIN/DIN parents, but INs are not counted by their parents because they are resident on the IN list.

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 IN

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 IN

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 IN
Returns:
the type of log entry
See Also:
IN.getLogType()

getLogSize

public int getLogSize()
Specified by:
getLogSize in interface LogWritable
Overrides:
getLogSize in class IN
Returns:
number of bytes used to store this object.
See Also:
IN.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
Parameters:
logBuffer - is the destination buffer
See Also:
IN.writeToLog(java.nio.ByteBuffer)

readFromLog

public void readFromLog(ByteBuffer itemBuffer,
                        byte entryTypeVersion)
                 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, byte)

dumpLogAdditional

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

Overrides:
dumpLogAdditional in class IN

beginTag

public String beginTag()
Overrides:
beginTag in class IN

endTag

public String endTag()
Overrides:
endTag in class IN

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 DIN, without

toString

public String toString()
Description copied from class: Node
Default toString method at the root of the tree.

Overrides:
toString in class IN

shortClassName

public String shortClassName()
Overrides:
shortClassName in class IN


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