Class S3MetaRequest
- java.lang.Object
-
- software.amazon.awssdk.crt.CrtResource
-
- software.amazon.awssdk.crt.s3.S3MetaRequest
-
- All Implemented Interfaces:
AutoCloseable
public class S3MetaRequest extends CrtResource
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class software.amazon.awssdk.crt.CrtResource
CrtResource.ResourceInstance
-
-
Constructor Summary
Constructors Constructor Description S3MetaRequest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()CompletableFuture<Void>getShutdownCompleteFuture()voidincrementReadWindow(long bytes)Increment the flow-control window, so that response data continues downloading.ResumeTokenpause()Pauses meta request and returns a token that can be used to resume a meta request.CompletableFuture<ResumeToken>pauseAsync()Asynchronously pause the meta request.-
Methods inherited from class software.amazon.awssdk.crt.CrtResource
addRef, addRef, addReferenceTo, close, close, collectNativeResource, collectNativeResources, decRef, decRef, decRef, getNativeHandle, getResourceLogDescription, isNull, logNativeResources, logNativeResources, removeReferenceTo, setDescription, waitForNoResources
-
-
-
-
Method Detail
-
getShutdownCompleteFuture
public CompletableFuture<Void> getShutdownCompleteFuture()
-
cancel
public void cancel()
-
pause
public ResumeToken pause()
Pauses meta request and returns a token that can be used to resume a meta request. For PutObject resume, input stream should always start at the beginning, already uploaded parts will be skipped, but checksums on those will be verified if request specified checksum algo.- Returns:
- token to resume request. might be null if request has not started executing yet
-
pauseAsync
public CompletableFuture<ResumeToken> pauseAsync()
Asynchronously pause the meta request. Works for both uploads (PUT) and downloads (GET). The returned future completes once all in-flight work has finished (in-flight parts for uploads, file writes for downloads) and the resume token is ready.For PutObject resume, input stream should always start at the beginning, already uploaded parts will be skipped, but checksums on those will be verified if the request specified a checksum algorithm.
Note: consuming a download (GET) resume token to resume via meta request options is not supported yet. To resume a download, issue a new ranged GET starting at
ResumeToken.getContinuesDownloadedBytes()(offset fromResumeToken.getObjectRangeStart()) through the end of the original download.- Returns:
- future completed with the resume token once the pause completes. The token may be null if the request had not progressed far enough to produce one (equivalent to restarting the transfer). Completed exceptionally with a CrtRuntimeException if the pause failed.
-
incrementReadWindow
public void incrementReadWindow(long bytes)
Increment the flow-control window, so that response data continues downloading.If the client was created with
S3ClientOptions.withReadBackpressureEnabled(boolean)set true, each S3MetaRequest has a flow-control window that shrinks as response body data is downloaded (headers do not affect the size of the window).S3ClientOptions.withInitialReadWindowSize(long)sets the starting size for each S3MetaRequest's window. Whenever the window reaches zero, data stops downloading. Increment the window to keep data flowing. Maintain a larger window to keep up a high download throughput, parts cannot download in parallel unless the window is large enough to hold multiple parts. Maintain a smaller window to limit the amount of data buffered in memory.If backpressure is disabled this call has no effect, data is downloaded as fast as possible.
WARNING: This feature is experimental. Currently, backpressure is only applied to GetObject requests which are split into multiple parts, and you may still receive some data after the window reaches zero.
- Parameters:
bytes- size to increment window by- See Also:
S3ClientOptions.withReadBackpressureEnabled(boolean)
-
-