com.sleepycat.je.cleaner
Class PackedOffsets

java.lang.Object
  extended by com.sleepycat.je.cleaner.PackedOffsets
All Implemented Interfaces:
Loggable

public class PackedOffsets
extends Object
implements Loggable

Stores a sorted list of LSN offsets in a packed short representation. Each stored value is the difference between two consecutive offsets. The stored values are stored as one or more shorts where each short holds 0x7fff values. Shorts are in LSB order. The value is negated if more shorts for the same offset follow; this works because offsets are always positive values.


Nested Class Summary
(package private)  class PackedOffsets.Iterator
          An iterator over all offsets.
 
Constructor Summary
PackedOffsets()
          Creates an empty object.
 
Method Summary
 void dumpLog(StringBuilder buf, boolean verbose)
          Write the object into the string buffer for log dumping.
 int getExtraMemorySize()
          Return the extra memory used by this object when the pack() method has been called to allocate the data array.
 int getLogSize()
           
 long getTransactionId()
          Never called.
(package private)  PackedOffsets.Iterator iterator()
          Returns an iterator over all offsets.
 boolean logicalEquals(Loggable other)
           
 void pack(long[] offsets)
          Packs the given offsets, replacing any offsets stored in this object.
 void readFromLog(ByteBuffer buf, int entryVersion)
          Initialize this object from the data in itemBuf.
(package private)  long[] toArray()
          Returns the unpacked offsets.
 String toString()
           
 void writeToLog(ByteBuffer buf)
          Serialize this object into the buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PackedOffsets

public PackedOffsets()
Creates an empty object.

Method Detail

iterator

PackedOffsets.Iterator iterator()
Returns an iterator over all offsets.


pack

public void pack(long[] offsets)
Packs the given offsets, replacing any offsets stored in this object.


toArray

long[] toArray()
Returns the unpacked offsets.


getExtraMemorySize

public int getExtraMemorySize()
Return the extra memory used by this object when the pack() method has been called to allocate the data array.


getLogSize

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

writeToLog

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

Specified by:
writeToLog in interface Loggable
Parameters:
buf - is the destination buffer
See Also:
Loggable.writeToLog(java.nio.ByteBuffer)

readFromLog

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

Specified by:
readFromLog in interface Loggable
See Also:
Loggable.readFromLog(java.nio.ByteBuffer, int)

dumpLog

public void dumpLog(StringBuilder buf,
                    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:
buf - destination string buffer
verbose - if true, dump the full, verbose version
See Also:
Loggable.dumpLog(java.lang.StringBuilder, boolean)

getTransactionId

public long getTransactionId()
Never called.

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.

toString

public String toString()
Overrides:
toString in class Object


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