com.sleepycat.je.log.entry
Class LNLogEntry

java.lang.Object
  extended by com.sleepycat.je.log.entry.LNLogEntry
All Implemented Interfaces:
LogEntry, NodeLogEntry, LoggableObject, LogWritable, Cloneable
Direct Known Subclasses:
DeletedDupLNLogEntry

public class LNLogEntry
extends Object
implements LogEntry, LoggableObject, NodeLogEntry

LNLogEntry embodies all LN transactional log entries. These entries contain:

   ln
   databaseid
   key            
   abortLsn       -- if transactional
   abortKnownDeleted -- if transactional
   txn            -- if transactional
 


Constructor Summary
LNLogEntry(Class logClass, boolean isTransactional)
           
LNLogEntry(LogEntryType entryType, LN ln, DatabaseId dbId, byte[] key, long abortLsn, boolean abortKnownDeleted, Txn txn)
           
 
Method Summary
 Object clone()
           
 boolean countAsObsoleteWhenLogged()
          Returns true for a deleted LN to count it immediately as obsolete.
 StringBuffer dumpEntry(StringBuffer sb, boolean verbose)
          Print out the contents of an entry.
 boolean getAbortKnownDeleted()
           
 long getAbortLsn()
           
 DatabaseId getDbId()
           
 byte[] getDupKey()
           
 byte[] getKey()
           
 LN getLN()
           
 int getLogSize()
           
 LogEntryType getLogType()
          All objects that are reponsible for a generating a type of log entry must implement this.
 Object getMainItem()
           
 long getNodeId()
          Returns the node ID.
 long getTransactionId()
           
 Long getTxnId()
           
 Txn getUserTxn()
           
 boolean isTransactional()
           
 boolean marshallOutsideWriteLatch()
          Return true if this item can be marshalled outside the log write latch.
 void postLogWork(long justLoggedLsn)
          For LN entries, we need to record the latest LSN for that node with the owning transaction, within the protection of the log latch.
 void readEntry(ByteBuffer entryBuffer, int entrySize, byte entryTypeVersion, boolean readFullItem)
          Read in an log 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

LNLogEntry

public LNLogEntry(Class logClass,
                  boolean isTransactional)

LNLogEntry

public LNLogEntry(LogEntryType entryType,
                  LN ln,
                  DatabaseId dbId,
                  byte[] key,
                  long abortLsn,
                  boolean abortKnownDeleted,
                  Txn txn)
Method Detail

readEntry

public void readEntry(ByteBuffer entryBuffer,
                      int entrySize,
                      byte entryTypeVersion,
                      boolean readFullItem)
               throws DatabaseException
Description copied from interface: LogEntry
Read in an log entry.

Specified by:
readEntry in interface LogEntry
Throws:
DatabaseException
See Also:
LogEntry.readEntry(java.nio.ByteBuffer, int, byte, boolean)

dumpEntry

public StringBuffer dumpEntry(StringBuffer sb,
                              boolean verbose)
Description copied from interface: LogEntry
Print out the contents of an entry.

Specified by:
dumpEntry in interface LogEntry
See Also:
LogEntry.dumpEntry(java.lang.StringBuffer, boolean)

getMainItem

public Object getMainItem()
Specified by:
getMainItem in interface LogEntry
Returns:
the first item of the log entry
See Also:
LogEntry.getMainItem()

clone

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

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()

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()

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 ln if it can be marshalled outside the log write latch.

countAsObsoleteWhenLogged

public boolean countAsObsoleteWhenLogged()
Returns true for a deleted LN to count it immediately as obsolete.

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

postLogWork

public void postLogWork(long justLoggedLsn)
                 throws DatabaseException
For LN entries, we need to record the latest LSN for that node with the owning transaction, within the protection of the log latch. This is a callback for the log manager to do that recording.

Specified by:
postLogWork in interface LoggableObject
Throws:
DatabaseException
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)

getLN

public LN getLN()

getDbId

public DatabaseId getDbId()

getKey

public byte[] getKey()

getDupKey

public byte[] getDupKey()

getAbortLsn

public long getAbortLsn()

getAbortKnownDeleted

public boolean getAbortKnownDeleted()

getTxnId

public Long getTxnId()

getUserTxn

public Txn getUserTxn()


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