Class DirectAccessIndexInput

java.lang.Object
org.apache.lucene.store.DataInput
org.apache.lucene.store.IndexInput
org.apache.lucene.store.FilterIndexInput
org.elasticsearch.common.lucene.store.DirectAccessIndexInput
All Implemented Interfaces:
Closeable, AutoCloseable, Cloneable, org.elasticsearch.core.DirectAccessInput

public class DirectAccessIndexInput extends org.apache.lucene.store.FilterIndexInput implements org.elasticsearch.core.DirectAccessInput
A test utility that wraps an IndexInput and implements DirectAccessInput, serving direct ByteBuffer slices backed by CloseableByteBuffer for deterministic native memory management. The buffers are allocated via NativeAccess and freed eagerly when the action completes.
  • Field Summary

    Fields inherited from class org.apache.lucene.store.FilterIndexInput

    in
  • Constructor Summary

    Constructors
    Constructor
    Description
    DirectAccessIndexInput(String resourceDescription, org.apache.lucene.store.IndexInput delegate, byte[] data, NativeAccess nativeAccess)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.lucene.store.IndexInput
     
    org.apache.lucene.store.IndexInput
    slice(String sliceDescription, long offset, long length)
     
    boolean
    withByteBufferSlice(long offset, long length, org.elasticsearch.core.CheckedConsumer<ByteBuffer,IOException> action)
     
    boolean
    withByteBufferSlices(long[] offsets, int length, int count, org.elasticsearch.core.CheckedConsumer<ByteBuffer[],IOException> action)
     

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

    close, getDelegate, getFilePointer, length, readByte, readBytes, seek, unwrap, unwrapOnlyTest

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

    getFullSliceDescription, isLoaded, prefetch, randomAccessSlice, skipBytes, slice, toString, updateIOContext

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

    readBytes, readFloats, readGroupVInt, readInt, readInts, readLong, readLongs, readMapOfStrings, readSetOfStrings, readShort, readString, readVInt, readVLong, readZInt, readZLong

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • DirectAccessIndexInput

      public DirectAccessIndexInput(String resourceDescription, org.apache.lucene.store.IndexInput delegate, byte[] data, NativeAccess nativeAccess)
  • Method Details

    • withByteBufferSlice

      public boolean withByteBufferSlice(long offset, long length, org.elasticsearch.core.CheckedConsumer<ByteBuffer,IOException> action) throws IOException
      Specified by:
      withByteBufferSlice in interface org.elasticsearch.core.DirectAccessInput
      Throws:
      IOException
    • withByteBufferSlices

      public boolean withByteBufferSlices(long[] offsets, int length, int count, org.elasticsearch.core.CheckedConsumer<ByteBuffer[],IOException> action) throws IOException
      Specified by:
      withByteBufferSlices in interface org.elasticsearch.core.DirectAccessInput
      Throws:
      IOException
    • clone

      public org.apache.lucene.store.IndexInput clone()
      Overrides:
      clone in class org.apache.lucene.store.IndexInput
    • slice

      public org.apache.lucene.store.IndexInput slice(String sliceDescription, long offset, long length) throws IOException
      Overrides:
      slice in class org.apache.lucene.store.FilterIndexInput
      Throws:
      IOException