com.sleepycat.je.tree
Class Node

java.lang.Object
  extended by com.sleepycat.je.tree.Node
All Implemented Interfaces:
Loggable
Direct Known Subclasses:
IN, LN

public abstract class Node
extends Object
implements Loggable

A Node contains all the common base information for any JE B-Tree node.


Field Summary
static long NULL_NODE_ID
           
 
Constructor Summary
protected Node()
          Only for subclasses.
 
Method Summary
(package private) abstract  void accountForDeferredWriteSubtreeRemoval(INList inList, IN subtreeParent)
          For a deferred-write DB, account for a deleted subtree.
(package private) abstract  void accountForSubtreeRemoval(INList inList, LocalUtilizationTracker tracker)
          For a regular (not deferred-write) DB, account for a deleted subtree.
 boolean containsDuplicates()
          Since DIN/DBIN/DupCountLN are no longer used in the Btree, this method should normally only be used by dup conversion or entities that do not access records via the Btree.
 void dump(int nSpaces)
           
 void dumpLog(StringBuilder sb, boolean verbose)
          Write the object into the string buffer for log dumping.
(package private)  String dumpString(int nSpaces, boolean dumpTags)
           
abstract  LogEntryType getGenericLogType()
          Returns the generic LogEntryType for this node.
 int getLevel()
          Cover for LN's and just return 0 since they'll always be at the bottom of the tree.
 int getLogSize()
           
 long getMemorySizeIncludedByParent()
          Return the approximate size of this node in memory, if this size should be included in its parents memory accounting.
 long getTransactionId()
           
 String getType()
           
abstract  void incFetchStats(EnvironmentImpl envImpl, boolean isMiss)
          We categorize fetch stats by the type of node, so node subclasses update different stats.
 boolean isBIN()
           
 boolean isCompressible()
           
 boolean isIN()
           
 boolean isLN()
           
(package private) abstract  boolean isValidForDelete()
           
 void latchShared()
           
 void latchShared(CacheMode ignore)
           
 void postFetchInit(DatabaseImpl db, long sourceLsn)
           
 void readFromLog(ByteBuffer itemBuffer, int entryVersion)
          Initialize this object from the data in itemBuf.
(package private) abstract  void rebuildINList(INList inList)
          Add yourself to the in memory list if you're a type of node that should belong.
 void releaseLatch()
           
 String toString()
          Default toString method at the root of the tree.
 void verify(byte[] maxKey)
           
 void writeToLog(ByteBuffer logBuffer)
          Serialize this object into the buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.sleepycat.je.log.Loggable
logicalEquals
 

Field Detail

NULL_NODE_ID

public static final long NULL_NODE_ID
See Also:
Constant Field Values
Constructor Detail

Node

protected Node()
Only for subclasses.

Method Detail

postFetchInit

public void postFetchInit(DatabaseImpl db,
                          long sourceLsn)
                   throws DatabaseException
Throws:
DatabaseException - from subclasses.

latchShared

public void latchShared()
                 throws DatabaseException
Throws:
DatabaseException - from subclasses.

latchShared

public void latchShared(CacheMode ignore)
                 throws DatabaseException
Throws:
DatabaseException - from subclasses.

releaseLatch

public void releaseLatch()

verify

public void verify(byte[] maxKey)
            throws DatabaseException
Throws:
DatabaseException - from subclasses.

containsDuplicates

public boolean containsDuplicates()
Since DIN/DBIN/DupCountLN are no longer used in the Btree, this method should normally only be used by dup conversion or entities that do not access records via the Btree.

Returns:
true if this node is a duplicate-bearing node type, false if otherwise.

getLevel

public int getLevel()
Cover for LN's and just return 0 since they'll always be at the bottom of the tree.


rebuildINList

abstract void rebuildINList(INList inList)
                     throws DatabaseException
Add yourself to the in memory list if you're a type of node that should belong.

Throws:
DatabaseException

accountForSubtreeRemoval

abstract void accountForSubtreeRemoval(INList inList,
                                       LocalUtilizationTracker tracker)
                                throws DatabaseException
For a regular (not deferred-write) DB, account for a deleted subtree.

Throws:
DatabaseException

accountForDeferredWriteSubtreeRemoval

abstract void accountForDeferredWriteSubtreeRemoval(INList inList,
                                                    IN subtreeParent)
                                             throws DatabaseException
For a deferred-write DB, account for a deleted subtree. [#21348]

Throws:
DatabaseException

isValidForDelete

abstract boolean isValidForDelete()
                           throws DatabaseException
Returns:
true if you're part of a deletable subtree.
Throws:
DatabaseException

isLN

public boolean isLN()

isIN

public boolean isIN()

isBIN

public boolean isBIN()

isCompressible

public boolean isCompressible()

getMemorySizeIncludedByParent

public long getMemorySizeIncludedByParent()
Return the approximate size of this node in memory, if this size should be included in its parents memory accounting. For example, all INs return 0, because they are accounted for individually. LNs must return a count, they're not counted on the INList.


toString

public String toString()
Default toString method at the root of the tree.

Overrides:
toString in class Object

dump

public void dump(int nSpaces)

dumpString

String dumpString(int nSpaces,
                  boolean dumpTags)

getType

public String getType()

incFetchStats

public abstract void incFetchStats(EnvironmentImpl envImpl,
                                   boolean isMiss)
We categorize fetch stats by the type of node, so node subclasses update different stats.


getGenericLogType

public abstract LogEntryType getGenericLogType()
Returns the generic LogEntryType for this node. Returning the actual type used to log the node is not always possible. Specifically, for LN nodes the generic type is less specific than the actual type used to log the node: + A non-transactional type is always returned. + LOG_INS_LN is returned rather than LOG_UPD_LN. + LOG_DEL_LN is returned rather than LOG_DEL_DUPLN.


getLogSize

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

writeToLog

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

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

readFromLog

public void readFromLog(ByteBuffer itemBuffer,
                        int entryVersion)
Description copied from interface: Loggable
Initialize this object from the data in itemBuf.

Specified by:
readFromLog in interface Loggable
See Also:
Loggable.readFromLog(java.nio.ByteBuffer, int)

dumpLog

public void dumpLog(StringBuilder sb,
                    boolean verbose)
Description copied from interface: Loggable
Write the object into the string buffer for log dumping. Each object should be dumped without indentation or new lines and should be valid XML.

Specified by:
dumpLog in interface Loggable
Parameters:
sb - destination string buffer
verbose - if true, dump the full, verbose version
See Also:
Loggable.dumpLog(java.lang.StringBuilder, boolean)

getTransactionId

public long getTransactionId()
Specified by:
getTransactionId in interface Loggable
Returns:
the transaction id embedded within this loggable object. Objects that have no transaction id should return 0.
See Also:
Loggable.getTransactionId()


Copyright (c) 2004-2012 Oracle. All rights reserved.