com.sleepycat.je.log
Class FileReader.ReadWindow

java.lang.Object
  extended by com.sleepycat.je.log.FileReader.ReadWindow
Direct Known Subclasses:
FeederReader.SwitchWindow
Enclosing class:
FileReader

protected static class FileReader.ReadWindow
extends Object

A ReadWindow provides a swathe of data read from the JE log.


Field Summary
protected  long endOffset
           
protected  EnvironmentImpl envImpl
           
protected  FileManager fileManager
           
protected  ByteBuffer readBuffer
           
protected  long startOffset
           
 
Constructor Summary
protected FileReader.ReadWindow(int readBufferSize, EnvironmentImpl envImpl)
           
 
Method Summary
protected  void adjustReadBufferSize(int amountToRead)
          Change the read buffer size if we start hitting large log entries so we don't get into an expensive cycle of multiple reads and piecing together of log entries.
(package private)  int capacity()
           
 boolean containsLsn(long targetFileNumber, long targetOffset)
           
(package private)  boolean containsOffset(long targetOffset)
           
 long currentFileNum()
           
protected  void fillFromFile(FileHandle fileHandle, long targetOffset)
           
protected  boolean fillNext(boolean singleFile, int bytesNeeded)
          Fill up the read buffer with more data, moving along to the following file (next largest number) if needed.
(package private)  int getAndResetNReads()
          Returns the number of reads since the last time this method was called.
(package private)  ByteBuffer getBuffer()
           
 long getEndOffset()
           
(package private)  long getNRepeatIteratorReads()
           
(package private)  boolean hasRemaining()
           
(package private)  void incrementBufferPosition(int increment)
           
 void initAtFileStart(long startLsn)
           
 void positionBuffer(long targetOffset)
           
(package private)  int remaining()
           
protected  void setFileNum(long fileNum, int logVersion)
          Ensure that whenever we change the fileNum, the logVersion is also updated.
 void slideAndFill(long windowfileNum, long windowStartOffset, long targetOffset)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

startOffset

protected long startOffset

endOffset

protected long endOffset

readBuffer

protected ByteBuffer readBuffer

envImpl

protected final EnvironmentImpl envImpl

fileManager

protected final FileManager fileManager
Constructor Detail

FileReader.ReadWindow

protected FileReader.ReadWindow(int readBufferSize,
                                EnvironmentImpl envImpl)
Method Detail

initAtFileStart

public void initAtFileStart(long startLsn)

getEndOffset

public long getEndOffset()

setFileNum

protected void setFileNum(long fileNum,
                          int logVersion)
Ensure that whenever we change the fileNum, the logVersion is also updated. The fileNum and logVersion fields should be kept private.


currentFileNum

public long currentFileNum()

containsOffset

boolean containsOffset(long targetOffset)

containsLsn

public boolean containsLsn(long targetFileNumber,
                           long targetOffset)

positionBuffer

public void positionBuffer(long targetOffset)

incrementBufferPosition

void incrementBufferPosition(int increment)

slideAndFill

public void slideAndFill(long windowfileNum,
                         long windowStartOffset,
                         long targetOffset)
                  throws ChecksumException,
                         FileNotFoundException,
                         DatabaseException
Throws:
ChecksumException
FileNotFoundException
DatabaseException

fillNext

protected boolean fillNext(boolean singleFile,
                           int bytesNeeded)
                    throws ChecksumException,
                           FileNotFoundException,
                           FileReader.EOFException,
                           DatabaseException
Fill up the read buffer with more data, moving along to the following file (next largest number) if needed.

Returns:
true if the fill moved us to a new file.
Throws:
ChecksumException
FileNotFoundException
FileReader.EOFException
DatabaseException

fillFromFile

protected void fillFromFile(FileHandle fileHandle,
                            long targetOffset)
                     throws DatabaseException
Throws:
DatabaseException

adjustReadBufferSize

protected void adjustReadBufferSize(int amountToRead)
Change the read buffer size if we start hitting large log entries so we don't get into an expensive cycle of multiple reads and piecing together of log entries.


capacity

int capacity()

remaining

int remaining()

hasRemaining

boolean hasRemaining()

getBuffer

ByteBuffer getBuffer()

getAndResetNReads

int getAndResetNReads()
Returns the number of reads since the last time this method was called.


getNRepeatIteratorReads

long getNRepeatIteratorReads()

toString

public String toString()
Overrides:
toString in class Object


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