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

    Constructors
    Constructor
    Description
    PrefetchableBufferedChecksumIndexInput(org.apache.lucene.store.IndexInput indexInput)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    checkBuffer(long length)
    Based on the greatestFetchBlock and the current positon of the underlying FDBIndexInput, it will decide how many blocks to fetch.
    byte
     
    void
    readBytes(byte[] b, int offset, int len)
     
    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.

    Methods inherited from class org.apache.lucene.store.BufferedChecksumIndexInput

    clone, close, getChecksum, getFilePointer, length, slice

    Methods inherited from class org.apache.lucene.store.ChecksumIndexInput

    seek

    Methods inherited from class org.apache.lucene.store.IndexInput

    getFullSliceDescription, randomAccessSlice, toString

    Methods inherited from class org.apache.lucene.store.DataInput

    readBytes, readInt, readLELongs, readLong, readMapOfStrings, readSetOfStrings, readShort, readString, readVInt, readVLong, readZInt, readZLong, skipBytes

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • 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

      public byte readByte() throws IOException
      Overrides:
      readByte in class org.apache.lucene.store.BufferedChecksumIndexInput
      Throws:
      IOException
    • readBytes

      public void readBytes(byte[] b, int offset, int len) throws IOException
      Overrides:
      readBytes in class org.apache.lucene.store.BufferedChecksumIndexInput
      Throws:
      IOException