com.sleepycat.je.tree
Class BINDelta

java.lang.Object
  extended by com.sleepycat.je.tree.BINDelta
All Implemented Interfaces:
Loggable

public class BINDelta
extends Object
implements Loggable

BINDelta contains the information needed to create a partial (delta) BIN log entry. It also knows how to combine a full BIN log entry and a delta to generate a new BIN.


Constructor Summary
BINDelta()
          For instantiating from the log.
BINDelta(BIN bin)
          Read a BIN and create the deltas.
BINDelta(SizeofMarker marker)
          For Sizeof.
 
Method Summary
 void dumpLog(StringBuilder sb, boolean verbose)
          Write the object into the string buffer for log dumping.
 DatabaseId getDbId()
           
 long getLastFullLsn()
           
 int getLogSize()
           
 long getMemorySize()
          Returns the number of bytes occupied by this object.
(package private)  int getNumDeltas()
           
(package private) static int getNumDeltas(BIN bin)
           
 long getPrevDeltaLsn()
           
 byte[] getSearchKey()
          Returns a key that can be used to find the BIN associated with this delta.
 long getTransactionId()
           
 boolean logicalEquals(Loggable other)
           
 void readFromLog(ByteBuffer itemBuffer, int entryVersion)
          Initialize this object from the data in itemBuf.
 BIN reconstituteBIN(DatabaseImpl dbImpl)
          Create a BIN by fetching the full version and applying the deltas.
 void reconstituteBIN(DatabaseImpl dbImpl, BIN fullBIN)
          Given a full version BIN, apply the deltas.
 void writeToLog(ByteBuffer logBuffer)
          Serialize this object into the buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BINDelta

public BINDelta(BIN bin)
Read a BIN and create the deltas.


BINDelta

public BINDelta()
For instantiating from the log.


BINDelta

public BINDelta(SizeofMarker marker)
For Sizeof.

Method Detail

getNumDeltas

int getNumDeltas()
Returns:
a count of deltas for this BIN.

getNumDeltas

static int getNumDeltas(BIN bin)
Returns:
a count of deltas for the given BIN, if a BINDelta were created.

getDbId

public DatabaseId getDbId()
Returns:
the dbId for this BIN.

getLastFullLsn

public long getLastFullLsn()
Returns:
the last full version of this BIN

getPrevDeltaLsn

public long getPrevDeltaLsn()
Returns:
the prior delta version of this BIN, or NULL_LSN if the prior version is a full BIN. The returned value is the LSN that is obsoleted by this delta.

getSearchKey

public byte[] getSearchKey()
Returns a key that can be used to find the BIN associated with this delta. The key of any slot will do.


reconstituteBIN

public BIN reconstituteBIN(DatabaseImpl dbImpl)
Create a BIN by fetching the full version and applying the deltas.


reconstituteBIN

public void reconstituteBIN(DatabaseImpl dbImpl,
                            BIN fullBIN)
Given a full version BIN, apply the deltas.


getLogSize

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

writeToLog

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

Specified by:
writeToLog in interface Loggable
Parameters:
logBuffer - is the destination buffer

readFromLog

public void readFromLog(ByteBuffer itemBuffer,
                        int entryVersion)
Description copied from interface: Loggable
Initialize this object from the data in itemBuf.

Specified by:
readFromLog in interface Loggable

dumpLog

public void dumpLog(StringBuilder sb,
                    boolean verbose)
Description copied from interface: Loggable
Write the object into the string buffer for log dumping. Each object should be dumped without indentation or new lines and should be valid XML.

Specified by:
dumpLog in interface Loggable
Parameters:
sb - destination string buffer
verbose - if true, dump the full, verbose version

getTransactionId

public long getTransactionId()
Specified by:
getTransactionId in interface Loggable
Returns:
the transaction id embedded within this loggable object. Objects that have no transaction id should return 0.
See Also:
Loggable.getTransactionId()

logicalEquals

public boolean logicalEquals(Loggable other)
Specified by:
logicalEquals in interface Loggable
Returns:
true if these two loggable items are logically the same. Used for replication testing.
See Also:
Always return false, this item should never be compared.

getMemorySize

public long getMemorySize()
Returns the number of bytes occupied by this object. Deltas are not stored in the Btree, but they are budgeted during a SortedLSNTreeWalker run.



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