com.sleepycat.je.log.entry
Class LNLogEntry

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

public class LNLogEntry
extends BaseEntry
implements LogEntry, NodeLogEntry

LNLogEntry embodies all LN transactional log entries. On disk, an LN log entry contains:

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


Field Summary
 
Fields inherited from class com.sleepycat.je.log.entry.BaseEntry
entryType, logClass
 
Constructor Summary
LNLogEntry(java.lang.Class LNClass)
           
LNLogEntry(LogEntryType entryType, LN ln, DatabaseId dbId, byte[] key, long abortLsn, boolean abortKnownDeleted, Txn txn)
           
 
Method Summary
 java.lang.Object clone()
           
 boolean countAsObsoleteWhenLogged()
          Returns true for a deleted LN to count it immediately as obsolete.
 java.lang.StringBuffer dumpEntry(java.lang.StringBuffer sb, boolean verbose)
          Print out the contents of an entry.
 boolean getAbortKnownDeleted()
           
 long getAbortLsn()
           
 DatabaseId getDbId()
           
 byte[] getDupKey()
           
 byte[] getKey()
           
 LN getLN()
           
 java.lang.Object getMainItem()
           
 long getNodeId()
          Returns the node ID.
 int getSize()
           
 long getTransactionId()
           
 java.lang.Long getTxnId()
           
 Txn getUserTxn()
           
 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(LogEntryHeader header, java.nio.ByteBuffer entryBuffer, boolean readFullItem)
          Read in an log entry.
 void setLastLoggedSize(int size)
          By default, do nothing.
 void writeEntry(LogEntryHeader header, java.nio.ByteBuffer destBuffer)
          Serialize this object into the buffer.
 
Methods inherited from class com.sleepycat.je.log.entry.BaseEntry
getLogType, setLogType
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sleepycat.je.log.entry.LogEntry
getLogType, setLogType
 

Constructor Detail

LNLogEntry

public LNLogEntry(java.lang.Class LNClass)

LNLogEntry

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

readEntry

public void readEntry(LogEntryHeader header,
                      java.nio.ByteBuffer entryBuffer,
                      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(com.sleepycat.je.log.LogEntryHeader, java.nio.ByteBuffer, boolean)

dumpEntry

public java.lang.StringBuffer dumpEntry(java.lang.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 java.lang.Object getMainItem()
Specified by:
getMainItem in interface LogEntry
Returns:
the first item of the log entry
See Also:
LogEntry.getMainItem()

clone

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

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

getSize

public int getSize()
Specified by:
getSize in interface LogEntry
Returns:
size of byte buffer needed to store this entry.

setLastLoggedSize

public void setLastLoggedSize(int size)
Description copied from class: BaseEntry
By default, do nothing. This is overridden by some entries (LNs) to save the last logged size

Specified by:
setLastLoggedSize in interface LogEntry
Overrides:
setLastLoggedSize in class BaseEntry

writeEntry

public void writeEntry(LogEntryHeader header,
                       java.nio.ByteBuffer destBuffer)
Description copied from interface: LogEntry
Serialize this object into the buffer.

Specified by:
writeEntry in interface LogEntry
destBuffer - is the destination buffer
See Also:
LogEntry.writeEntry(com.sleepycat.je.log.LogEntryHeader, java.nio.ByteBuffer)

countAsObsoleteWhenLogged

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

Specified by:
countAsObsoleteWhenLogged in interface LogEntry
Overrides:
countAsObsoleteWhenLogged in class BaseEntry
See Also:
LogEntry.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 LogEntry
Overrides:
postLogWork in class BaseEntry
Throws:
DatabaseException
See Also:
LogEntry.postLogWork(long)

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 java.lang.Long getTxnId()

getUserTxn

public Txn getUserTxn()


Copyright 2004,2008 Oracle. All rights reserved.