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, Cloneable

public class INLogEntry
extends BaseEntry
implements LogEntry, INContainingEntry

INLogEntry embodies all IN log entries. On disk, an IN log entry contains (pre version 6)

        IN
        database id
        obsolete LSN  -- in version 2

 (version 6)
        database id
        obsolete LSN
        IN
 


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
 StringBuilder dumpEntry(StringBuilder sb, boolean verbose)
          Print out the contents of an entry.
 void dumpRep(StringBuilder sb)
          Never replicated.
 DatabaseId getDbId()
           
 IN getIN(DatabaseImpl dbImpl)
           
 Object getMainItem()
           
 long getNodeId()
           
 long getPrevDeltaLsn()
           
 long getPrevFullLsn()
           
 int getSize()
           
 long getTransactionId()
           
 boolean logicalEquals(LogEntry other)
           
 void readEntry(EnvironmentImpl envImpl, LogEntryHeader header, ByteBuffer entryBuffer)
          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
clone, getLastLoggedSize, getLogType, getNoArgsConstructor, getResolvedItem, isDeleted, newInstanceOfType, newInstanceOfType, postFetchInit, 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
clone, getLastLoggedSize, getLogType, getResolvedItem, 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(EnvironmentImpl envImpl,
                      LogEntryHeader header,
                      ByteBuffer entryBuffer)
Read in an IN entry.

Specified by:
readEntry in interface LogEntry

getPrevFullLsn

public long getPrevFullLsn()
Specified by:
getPrevFullLsn in interface INContainingEntry
Returns:
the LSN of the prior full version of this node, or NULL_LSN if there is no prior full version. 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.

getPrevDeltaLsn

public long getPrevDeltaLsn()
Specified by:
getPrevDeltaLsn in interface INContainingEntry
Returns:
the LSN of the prior delta version of this node, or NULL_LSN if the prior version is a full version. 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

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(DatabaseImpl dbImpl)
Specified by:
getIN in interface INContainingEntry
Returns:
the IN held within this log entry.

getNodeId

public long getNodeId()
Returns:
the IN's node ID.

getDbId

public DatabaseId getDbId()
Specified by:
getDbId in interface INContainingEntry
Specified by:
getDbId in interface LogEntry
Returns:
the ID of the database containing this entry, or null if this entry type is not part of a database.
See Also:
INContainingEntry.getDbId()

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-2012 Oracle. All rights reserved.