Package com.google.cloud.hadoop.fs.gcs
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 Summary
Constructors Constructor Description VectoredIOImpl(VectoredReadOptions vectoredReadOptions, GhfsGlobalStorageStatistics storageStatistics)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the VectoredIOImpl instance, releasing any allocated resources.voidreadVectored(List<? extends org.apache.hadoop.fs.FileRange> ranges, IntFunction<ByteBuffer> allocate, GoogleCloudStorageFileSystem gcsFs, FileInfo fileInfo, URI gcsPath, com.google.cloud.hadoop.fs.gcs.GhfsInputStreamStatistics streamStatistics)Reads data from Google Cloud Storage using vectored I/O operations.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.
-
-
-
Constructor Detail
-
VectoredIOImpl
public VectoredIOImpl(VectoredReadOptions vectoredReadOptions, GhfsGlobalStorageStatistics storageStatistics)
-
-
Method Detail
-
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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
-