Class VectoredIOImpl

java.lang.Object
com.google.cloud.hadoop.fs.gcs.VectoredIOImpl
All Implemented Interfaces:
Closeable, AutoCloseable

public class VectoredIOImpl extends Object implements Closeable
  • Constructor Details

  • Method Details

    • readVectored

      public void readVectored(List<? extends org.apache.hadoop.fs.FileRange> ranges, IntFunction<ByteBuffer> allocate, GoogleCloudStorageFileSystem gcsFs, FileInfo fileInfo, @Nonnull URI gcsPath, com.google.cloud.hadoop.fs.gcs.GhfsInputStreamStatistics streamStatistics) throws IOException
      Reads data from Google Cloud Storage using vectored I/O operations.
      Parameters:
      ranges - List of file ranges to read.
      allocate - Function to allocate ByteBuffer for reading.
      gcsFs - GCFS implementation to use while creating channel and reading content for ranges.
      fileInfo - FileInfo of the gcs object agaisnt which range request are fired, this can be null for some code path fall back to URI path provided.
      gcsPath - URI of the gcs object for which the range requests are fired.
      Throws:
      IOException - If invalid range is requested, offset<0.
    • validateNonOverlappingAndReturnSortedRanges

      public List<? extends org.apache.hadoop.fs.FileRange> validateNonOverlappingAndReturnSortedRanges(List<? extends org.apache.hadoop.fs.FileRange> input)
      Check if the input ranges are overlapping in nature. We call two ranges to be overlapping when start offset of second is less than the end offset of first. End offset is calculated as start offset + length.
      Parameters:
      input - list if input ranges.
      Returns:
      true/false based on logic explained above.
    • close

      public void close()
      Closes the VectoredIOImpl instance, releasing any allocated resources.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable