com.sleepycat.je.log.entry
Class INLogEntry

java.lang.Object
  extended by com.sleepycat.je.log.entry.INLogEntry
All Implemented Interfaces:
INContainingEntry, LogEntry, NodeLogEntry, LoggableObject, LogWritable, Cloneable

public class INLogEntry
extends Object
implements LogEntry, LoggableObject, NodeLogEntry, INContainingEntry

INLogEntry embodies all IN log entries. These entries contain an IN and a databaseId. This class can both write out an entry and read one in.


Constructor Summary
INLogEntry(Class logClass)
          Construct a log entry for reading.
INLogEntry(IN in)
          Construct a log entry for writing to the log.
 
Method Summary
 Object clone()
           
 boolean countAsObsoleteWhenLogged()
          Returns true if this item should be counted as obsoleted when logged.
 StringBuffer dumpEntry(StringBuffer sb, boolean verbose)
          Print out the contents of an entry.
 DatabaseId getDbId()
           
 IN getIN(EnvironmentImpl env)
           
 int getLogSize()
           
 LogEntryType getLogType()
          All objects that are reponsible for a generating a type of log entry must implement this.
 long getLsnOfIN(long lastReadLsn)
           
 Object getMainItem()
           
 long getNodeId()
          Returns the node ID.
 long getObsoleteLsn()
          Returns the LSN of the prior version of this node.
 long getTransactionId()
           
 boolean isTransactional()
           
 boolean marshallOutsideWriteLatch()
          Return true if this item can be marshalled outside the log write latch.
 void postLogWork(long justLoggedLsn)
          Do any processing we need to do after logging, while under the logging latch.
 void readEntry(ByteBuffer entryBuffer, int entrySize, byte entryTypeVersion, boolean readFullItem)
          Read in an IN entry.
 void writeToLog(ByteBuffer destBuffer)
          Serialize this object into the buffer.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

INLogEntry

public INLogEntry(Class logClass)
Construct a log entry for reading.


INLogEntry

public INLogEntry(IN in)
Construct a log entry for writing to the log.

Method Detail

readEntry

public void readEntry(ByteBuffer entryBuffer,
                      int entrySize,
                      byte entryTypeVersion,
                      boolean readFullItem)
               throws DatabaseException
Read in an IN entry.

Specified by:
readEntry in interface LogEntry
Throws:
DatabaseException

getObsoleteLsn

public long getObsoleteLsn()
Returns the LSN of the prior version of this node. Used for counting the prior version as obsolete. If the offset of the LSN is zero, only the file number is known because we read a version 1 log entry.


dumpEntry

public StringBuffer dumpEntry(StringBuffer sb,
                              boolean verbose)
Print out the contents of an entry.

Specified by:
dumpEntry in interface LogEntry

getMainItem

public Object getMainItem()
Specified by:
getMainItem in interface LogEntry
Returns:
the item in the log entry

clone

public Object clone()
             throws CloneNotSupportedException
Specified by:
clone in interface LogEntry
Overrides:
clone in class Object
Returns:
a shallow clone.
Throws:
CloneNotSupportedException

isTransactional

public boolean isTransactional()
Specified by:
isTransactional in interface LogEntry
Returns:
true if the LogEntry is a transactional log entry type.
See Also:
LogEntry.isTransactional()

getTransactionId

public long getTransactionId()
Specified by:
getTransactionId in interface LogEntry
Returns:
return the transaction id if this log entry is transactional, 0 otherwise.
See Also:
LogEntry.getTransactionId()

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
Returns:
the type of log entry
See Also:
LoggableObject.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
See Also:
Ask the in if it can be marshalled outside the log write latch.

countAsObsoleteWhenLogged

public boolean countAsObsoleteWhenLogged()
Description copied from interface: LoggableObject
Returns true if this item should be counted as obsoleted when logged. This currently applies to deleted LNs only.

Specified by:
countAsObsoleteWhenLogged in interface LoggableObject
See Also:
LoggableObject.countAsObsoleteWhenLogged()

postLogWork

public void postLogWork(long justLoggedLsn)
Description copied from interface: LoggableObject
Do any processing we need to do after logging, while under the logging latch.

Specified by:
postLogWork in interface LoggableObject
See Also:
LoggableObject.postLogWork(long)

getLogSize

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

writeToLog

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

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

getIN

public IN getIN(EnvironmentImpl env)
         throws DatabaseException
Specified by:
getIN in interface INContainingEntry
Returns:
the IN held within this log entry.
Throws:
DatabaseException

getNodeId

public long getNodeId()
Description copied from interface: NodeLogEntry
Returns the node ID. This value is redundant with the main item (Node) of a log entry. It is returned separately so that it can be obtained when the entry's main item (Node) is not loaded. Partial loading is an optimization for recovery.

Specified by:
getNodeId in interface NodeLogEntry
See Also:
NodeLogEntry.getNodeId()

getDbId

public DatabaseId getDbId()
Specified by:
getDbId in interface INContainingEntry
Returns:
the database id held within this log entry.
See Also:
INContainingEntry.getDbId()

getLsnOfIN

public long getLsnOfIN(long lastReadLsn)
Specified by:
getLsnOfIN in interface INContainingEntry
Returns:
the LSN that represents this IN. For a vanilla IN entry, it's the last lsn read by the log reader.


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