com.sleepycat.je.rep.util.ldiff
Class Window

java.lang.Object
  extended by com.sleepycat.je.rep.util.ldiff.Window

public class Window
extends Object

A rolling window of key/data pairs used by the ldiff algorithm.


Constructor Summary
Window(Cursor cursor, int windowSize)
          Create a window of the given size, starting at the next record pointed at by the Cursor.
 
Method Summary
 byte[] getBeginData()
           
 byte[] getBeginKey()
           
 long getChecksum()
          The checksum for the window.
 long getDiffSize()
           
 byte[] getMd5Hash()
          Compute the MD5 hash for the window.
 void nextWindow()
          Advance the window to the next block of records and update the rolling checksum.
 void rollWindow()
          Roll a window forward by one key.
 int size()
          The number of records in the window.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Window

public Window(Cursor cursor,
              int windowSize)
       throws Exception
Create a window of the given size, starting at the next record pointed at by the Cursor.

Parameters:
cursor - an open cursor on the database being diff'd
windowSize - the number of records to include in the window
Throws:
Exception
Method Detail

rollWindow

public void rollWindow()
                throws Exception
Roll a window forward by one key. The rolling checksum is adjusted to account for this move past one key/value pair. Note that the md5 hash associated with the window is computed on demand and is not updated here.

Throws:
Exception

nextWindow

public void nextWindow()
Advance the window to the next block of records and update the rolling checksum.


getChecksum

public long getChecksum()
The checksum for the window.

Returns:
the checksum for the window.

getBeginKey

public byte[] getBeginKey()

getBeginData

public byte[] getBeginData()

getDiffSize

public long getDiffSize()

getMd5Hash

public byte[] getMd5Hash()
Compute the MD5 hash for the window. This is an expensive operation and should be used sparingly.

Returns:
the MD5 for the window.

size

public int size()
The number of records in the window. The size of the window will match the value set during instantiation, until the end of the database is reached.

Returns:
the number of records in the window.


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