Class AbstractMeteredStorageObject
java.lang.Object
org.elasticsearch.xpack.esql.datasources.spi.AbstractMeteredStorageObject
- All Implemented Interfaces:
StorageObject
Base for the leaf
StorageObject providers (S3, GCS, Azure, HTTP, local): owns the
counters field and the metrics() accessor that each used to re-declare
identically, plus the shared native-async read completion handling (onReadComplete(java.util.concurrent.CompletableFuture<T>, java.util.function.BiConsumer<T, java.lang.Throwable>) /
deliverRead(org.elasticsearch.action.ActionListener<org.elasticsearch.xpack.esql.datasources.spi.DirectReadBuffer>, org.elasticsearch.xpack.esql.datasources.spi.DirectReadBuffer, long)). Subclasses keep their provider-specific orchestration (failure mapping,
status checks, buffer allocation) inline. Decorators do not extend this; they forward
metrics() to their delegate.-
Field Summary
FieldsFields inherited from interface org.elasticsearch.xpack.esql.datasources.spi.StorageObject
READ_TO_END, TRANSFER_BUFFER_SIZE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidattachMetrics(ExternalSourceMetrics metrics, String scheme) Attaches the node telemetry sink and the storageschemedimension so that this object's read/retry events are published toExternalSourceMetrics(in addition to the profile counters surfaced byStorageObject.metrics()).protected final voiddeliverRead(ActionListener<DirectReadBuffer> listener, DirectReadBuffer buffer, long startNanos) Hands a successfully-readbuffertolistener, recording the byte count and elapsed time.final StorageObjectMetricsmetrics()Returns cumulative I/O counters for reads against this object.protected static <T> CompletableFuture<T> onReadComplete(CompletableFuture<T> future, BiConsumer<T, Throwable> handler) Attacheshandlerto a native-async readfutureand returns the future.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.xpack.esql.datasources.spi.StorageObject
abortStream, exists, lastModified, length, newStream, newStream, path, readBytes, readBytesAsync, readBytesAsync, supportsNativeAsync
-
Field Details
-
counters
-
-
Constructor Details
-
AbstractMeteredStorageObject
public AbstractMeteredStorageObject()
-
-
Method Details
-
metrics
Description copied from interface:StorageObjectReturns cumulative I/O counters for reads against this object.Implementations that don't track I/O return
StorageObjectMetrics.ZERO. Decorator wrappers must delegate to the wrapped object so counters are attributed to the underlying store, not the wrapper layer.- Specified by:
metricsin interfaceStorageObject
-
attachMetrics
Description copied from interface:StorageObjectAttaches the node telemetry sink and the storageschemedimension so that this object's read/retry events are published toExternalSourceMetrics(in addition to the profile counters surfaced byStorageObject.metrics()). Called once by the operator wiring when it opens the object. The default is a no-op for objects that don't track I/O; decorator wrappers must forward to the wrapped object so the metrics attach to the underlying store, not the wrapper layer.- Specified by:
attachMetricsin interfaceStorageObject
-
onReadComplete
protected static <T> CompletableFuture<T> onReadComplete(CompletableFuture<T> future, BiConsumer<T, Throwable> handler) Attacheshandlerto a native-async readfutureand returns the future. The underlying client (the AWS SDK,HttpClient, the Azure reactive client) hands us aCompletableFuture, which captures anyErrora completion callback throws into the future it returns rather than letting it propagate. The handler is wrapped so a fatal error is rethrown to the uncaught-exception handler viaExceptionsHelper.maybeDieOnAnotherThread(java.lang.Throwable)instead of being swallowed. -
deliverRead
protected final void deliverRead(ActionListener<DirectReadBuffer> listener, DirectReadBuffer buffer, long startNanos) Hands a successfully-readbuffertolistener, recording the byte count and elapsed time. If delivery throws, closes the buffer so its breaker charge does not outlive the failed hand-off, then propagates.
-