Class GcsStorageObject
java.lang.Object
org.elasticsearch.xpack.esql.datasource.gcs.GcsStorageObject
- All Implemented Interfaces:
StorageObject
StorageObject implementation for Google Cloud Storage.
Supports full and range reads, metadata retrieval with caching, and efficient positional
byte reads via
ReadableByteChannel.read(ByteBuffer).
In addition to the required stream-based API, this class overrides:
readBytes(long, ByteBuffer)— usesReadChannel.read(ByteBuffer)for direct buffer reads without intermediate byte[] allocation.readBytesAsync(long, long, Executor, ActionListener)— executor-wrapped ReadChannel reads for the async API.supportsNativeAsync()— returnstruebecause this class provides custom async and byte-read implementations that are more efficient than the default InputStream wrappers. Note: the async path is executor-based (blocking a worker thread), not truly non-blocking likeHttpClient.sendAsync()orS3AsyncClient.
-
Field Summary
Fields inherited from interface org.elasticsearch.xpack.esql.datasources.spi.StorageObject
TRANSFER_BUFFER_SIZE -
Constructor Summary
ConstructorsConstructorDescriptionGcsStorageObject(com.google.cloud.storage.Storage storage, String bucket, String objectName, StoragePath path) GcsStorageObject(com.google.cloud.storage.Storage storage, String bucket, String objectName, StoragePath path, long length) GcsStorageObject(com.google.cloud.storage.Storage storage, String bucket, String objectName, StoragePath path, long length, Instant lastModified) -
Method Summary
Modifier and TypeMethodDescriptionbooleanexists()longlength()newStream(long position, long length) path()intreadBytes(long position, ByteBuffer target) voidreadBytesAsync(long position, long length, Executor executor, ActionListener<ByteBuffer> listener) booleantoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.xpack.esql.datasources.spi.StorageObject
readBytesAsync
-
Constructor Details
-
GcsStorageObject
public GcsStorageObject(com.google.cloud.storage.Storage storage, String bucket, String objectName, StoragePath path) -
GcsStorageObject
public GcsStorageObject(com.google.cloud.storage.Storage storage, String bucket, String objectName, StoragePath path, long length) -
GcsStorageObject
public GcsStorageObject(com.google.cloud.storage.Storage storage, String bucket, String objectName, StoragePath path, long length, Instant lastModified)
-
-
Method Details
-
newStream
- Specified by:
newStreamin interfaceStorageObject- Throws:
IOException
-
newStream
- Specified by:
newStreamin interfaceStorageObject- Throws:
IOException
-
length
- Specified by:
lengthin interfaceStorageObject- Throws:
IOException
-
lastModified
- Specified by:
lastModifiedin interfaceStorageObject- Throws:
IOException
-
exists
- Specified by:
existsin interfaceStorageObject- Throws:
IOException
-
path
- Specified by:
pathin interfaceStorageObject
-
readBytes
- Specified by:
readBytesin interfaceStorageObject- Throws:
IOException
-
readBytesAsync
public void readBytesAsync(long position, long length, Executor executor, ActionListener<ByteBuffer> listener) - Specified by:
readBytesAsyncin interfaceStorageObject
-
supportsNativeAsync
public boolean supportsNativeAsync()- Specified by:
supportsNativeAsyncin interfaceStorageObject
-
toString
-