com.sleepycat.je.tree
Class FileSummaryLN

java.lang.Object
  extended bycom.sleepycat.je.tree.Node
      extended bycom.sleepycat.je.tree.LN
          extended bycom.sleepycat.je.tree.FileSummaryLN
All Implemented Interfaces:
LoggableObject, LogReadable, LogWritable

public final class FileSummaryLN
extends LN

A FileSummaryLN represents a Leaf Node in the UtilizationProfile database.

The contents of the FileSummaryLN are not fixed until the moment at which the LN is added to the log. A base summary object contains the summary last added to the log. A tracked summary object contains live summary info being updated in real time. The tracked summary is added to the base summary just before logging it, and then the tracked summary is reset. This ensures that the logged summary will accurately reflect the totals calculated at the point in the log where the LN is added.

This is all done in the writeToLog method, which operates under the log write latch. All utilization tracking must be done under the log write latch.


Constructor Summary
FileSummaryLN()
          Creates an empty LN to be filled in from the log.
FileSummaryLN(FileSummary baseSummary)
          Creates a new LN with a given base summary.
 
Method Summary
 String beginTag()
           
static long bytesToFileNumber(byte[] bytes)
          Convert a FileSummaryLN key from a byte array to a long.
protected  long computeInMemorySize()
          Compute the approximate size of this node in memory for evictor invocation purposes.
protected  void dumpLogAdditional(StringBuffer sb)
          Dump additional fields.
 String dumpString(int nSpaces, boolean dumpTags)
           
 String endTag()
           
static byte[] fileNumberToBytes(long fileNum)
          Convert a FileSummaryLN key from a long to a byte array.
 FileSummary getBaseSummary()
          Returns the base summary for the file that is stored in the LN.
 int getLogSize()
           
 LogEntryType getLogType()
          All objects that are reponsible for a generating a type of log entry must implement this.
 TrackedFileSummary getTrackedSummary()
          Returns the tracked summary, or null if setTrackedSummary was not called.
protected  LogEntryType getTransactionalLogType()
          Log type for transactional entries.
 boolean marshallOutsideWriteLatch()
          Return true if this item can be marshalled outside the log write latch.
 void readFromLog(ByteBuffer itemBuffer)
          Initialize this object from the data in itemBuf.
 void setTrackedSummary(TrackedFileSummary trackedSummary)
          Sets the live summary object that will be added to the base summary at the time the LN is logged.
 String toString()
          Default toString method at the root of the tree.
 void writeToLog(ByteBuffer logBuffer)
          Serialize this object into the buffer.
 
Methods inherited from class com.sleepycat.je.tree.LN
accountForSubtreeRemoval, addToDirtyMap, canBeAncestor, copyData, delete, dumpLog, getData, getMemorySizeIncludedByParent, getTransactionId, isDeleted, isSoughtNode, isValidForDelete, log, logEntryIsTransactional, logProvisional, makeDeleted, modify, rebuildINList
 
Methods inherited from class com.sleepycat.je.tree.Node
containsDuplicates, dump, getLastId, getLevel, getNextNodeId, getNodeId, getType, matchLNByNodeId, postFetchInit, postLogWork, setLastNodeId, setNodeId, shortDescription, verify
 
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.LoggableObject
postLogWork
 

Constructor Detail

FileSummaryLN

public FileSummaryLN(FileSummary baseSummary)
Creates a new LN with a given base summary.


FileSummaryLN

public FileSummaryLN()
              throws DatabaseException
Creates an empty LN to be filled in from the log.

Method Detail

setTrackedSummary

public void setTrackedSummary(TrackedFileSummary trackedSummary)
Sets the live summary object that will be added to the base summary at the time the LN is logged.


getTrackedSummary

public TrackedFileSummary getTrackedSummary()
Returns the tracked summary, or null if setTrackedSummary was not called.


getBaseSummary

public FileSummary getBaseSummary()
Returns the base summary for the file that is stored in the LN.


computeInMemorySize

protected long computeInMemorySize()
Compute the approximate size of this node in memory for evictor invocation purposes.


bytesToFileNumber

public static long bytesToFileNumber(byte[] bytes)
Convert a FileSummaryLN key from a byte array to a long.


fileNumberToBytes

public static byte[] fileNumberToBytes(long fileNum)
Convert a FileSummaryLN key from a long to a byte array.


toString

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

Overrides:
toString in class Node

beginTag

public String beginTag()
Overrides:
beginTag in class LN

endTag

public String endTag()
Overrides:
endTag in class LN

dumpString

public String dumpString(int nSpaces,
                         boolean dumpTags)
Overrides:
dumpString in class LN

dumpLogAdditional

protected void dumpLogAdditional(StringBuffer sb)
Dump additional fields. Done this way so the additional info can be within the XML tags defining the dumped log entry.

Overrides:
dumpLogAdditional in class LN

getTransactionalLogType

protected LogEntryType getTransactionalLogType()
Log type for transactional entries.

Overrides:
getTransactionalLogType in class LN

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 LN
See Also:
LN.getLogType()

marshallOutsideWriteLatch

public boolean marshallOutsideWriteLatch()
Description copied from interface: LoggableObject
Return true if this item can be marshalled outside the log write latch.

Specified by:
marshallOutsideWriteLatch in interface LoggableObject
Overrides:
marshallOutsideWriteLatch in class Node
See Also:
FileSummaryLNs must be marshalled within the log write latch, because that critical section is used to guarantee that all previous log entries are reflected in the summary.

getLogSize

public int getLogSize()
Specified by:
getLogSize in interface LogWritable
Overrides:
getLogSize in class LN
See Also:
LN.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 LN
See Also:
LN.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 LN
Throws:
LogException
See Also:
LN.readFromLog(java.nio.ByteBuffer)


Copyright 2004 Sleepycat, Inc. All Rights Reserved.