com.sleepycat.je.log.entry
Class INLogEntry

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

public class INLogEntry
extends BaseEntry
implements LogEntry, NodeLogEntry, INContainingEntry

INLogEntry embodies all IN log entries. On disk, an IN log entry contains:

        IN
        database id
        obsolete LSN  -- in version 2
 


Field Summary
 
Fields inherited from class com.sleepycat.je.log.entry.BaseEntry
entryType
 
Constructor Summary
INLogEntry(Class<? extends IN> INClass)
          Construct a log entry for reading.
INLogEntry(IN in)
          Construct a log entry for writing to the log.
 
Method Summary
 Object clone()
           
 StringBuilder dumpEntry(StringBuilder sb, boolean verbose)
          Print out the contents of an entry.
 void dumpRep(StringBuilder sb)
          Never replicated.
 DatabaseId getDbId()
          All node entries have a database ID.
 IN getIN(EnvironmentImpl env)
           
 long getLsnOfIN(long lastReadLsn)
           
 Object getMainItem()
           
 long getNodeId()
          Returns the node ID.
 long getObsoleteLsn()
          Returns the LSN of the prior version of this node.
 int getSize()
           
 long getTransactionId()
           
 boolean logicalEquals(LogEntry other)
           
 void readEntry(LogEntryHeader header, ByteBuffer entryBuffer, boolean readFullItem)
          Read in an IN entry.
 void writeEntry(LogEntryHeader header, ByteBuffer destBuffer)
          Serialize this object into the buffer.
 
Methods inherited from class com.sleepycat.je.log.entry.BaseEntry
getLastLoggedSize, getLogType, isDeleted, newInstanceOfType, postLogWork, setLogType, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.sleepycat.je.log.entry.LogEntry
getLastLoggedSize, getLogType, isDeleted, postLogWork, setLogType
 

Constructor Detail

INLogEntry

public INLogEntry(Class<? extends IN> INClass)
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(LogEntryHeader header,
                      ByteBuffer entryBuffer,
                      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 StringBuilder dumpEntry(StringBuilder sb,
                               boolean verbose)
Print out the contents of an entry.

Specified by:
dumpEntry in interface LogEntry
Specified by:
dumpEntry in class BaseEntry

dumpRep

public void dumpRep(StringBuilder sb)
Never replicated.

Specified by:
dumpRep 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

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

getSize

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

writeEntry

public void writeEntry(LogEntryHeader header,
                       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)

getIN

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

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()
Description copied from interface: NodeLogEntry
All node entries have a database ID.

Specified by:
getDbId in interface INContainingEntry
Specified by:
getDbId in interface NodeLogEntry
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.

logicalEquals

public boolean logicalEquals(LogEntry other)
Specified by:
logicalEquals in interface LogEntry
Returns:
true if these two log entries are logically the same. Used for replication.
See Also:
INs from two different environments are never considered equal, because they have lsns that are environment-specific.


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