Class PrefetchableBufferedChecksumIndexInput
java.lang.Object
org.apache.lucene.store.DataInput
org.apache.lucene.store.IndexInput
org.apache.lucene.store.ChecksumIndexInput
org.apache.lucene.store.BufferedChecksumIndexInput
com.apple.foundationdb.record.lucene.codec.PrefetchableBufferedChecksumIndexInput
- All Implemented Interfaces:
Closeable,AutoCloseable,Cloneable
public class PrefetchableBufferedChecksumIndexInput
extends org.apache.lucene.store.BufferedChecksumIndexInput
An Index Input that attempts to keep a 10 block buffer in front or at the read at a minimum. The goal for this
class is to provide some parallelism for fetches from FDB when we are attempting to merge segments. The signaling
of when to prefetch occurs in the FDBIndexOutput#copyBytes method.
-
Constructor Summary
ConstructorsConstructorDescriptionPrefetchableBufferedChecksumIndexInput(org.apache.lucene.store.IndexInput indexInput) -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckBuffer(long length) Based on the greatestFetchBlock and the current positon of the underlying FDBIndexInput, it will decide how many blocks to fetch.bytereadByte()voidreadBytes(byte[] b, int offset, int len) voidsetExpectedBytes(long numberOfBytesToPrefetch) This method sets the total number of bytes to expect and then attempts to read ahead at least 10 blocks or the remaining number of blocks while reading.Methods inherited from class org.apache.lucene.store.BufferedChecksumIndexInput
clone, close, getChecksum, getFilePointer, length, sliceMethods inherited from class org.apache.lucene.store.ChecksumIndexInput
seekMethods inherited from class org.apache.lucene.store.IndexInput
getFullSliceDescription, randomAccessSlice, toStringMethods inherited from class org.apache.lucene.store.DataInput
readBytes, readInt, readLELongs, readLong, readMapOfStrings, readSetOfStrings, readShort, readString, readVInt, readVLong, readZInt, readZLong, skipBytes
-
Constructor Details
-
PrefetchableBufferedChecksumIndexInput
public PrefetchableBufferedChecksumIndexInput(org.apache.lucene.store.IndexInput indexInput)
-
-
Method Details
-
setExpectedBytes
public void setExpectedBytes(long numberOfBytesToPrefetch) This method sets the total number of bytes to expect and then attempts to read ahead at least 10 blocks or the remaining number of blocks while reading.- Parameters:
numberOfBytesToPrefetch- providing a signal to the total number of bytes to prefetch
-
checkBuffer
public void checkBuffer(long length) Based on the greatestFetchBlock and the current positon of the underlying FDBIndexInput, it will decide how many blocks to fetch.- Parameters:
length- position
-
readByte
- Overrides:
readBytein classorg.apache.lucene.store.BufferedChecksumIndexInput- Throws:
IOException
-
readBytes
- Overrides:
readBytesin classorg.apache.lucene.store.BufferedChecksumIndexInput- Throws:
IOException
-