meta request: support for should_continue cancellation callback#467
Open
grrtrr wants to merge 6 commits intoawslabs:mainfrom
Open
meta request: support for should_continue cancellation callback#467grrtrr wants to merge 6 commits intoawslabs:mainfrom
grrtrr wants to merge 6 commits intoawslabs:mainfrom
Conversation
Add a boolean `continue_callback`, which polls a request-cancellation flag set by the user. This matches the use-case of the `ContinueRequestHandler` / `ContinueRequest` / `ShouldContinue` boolean functions used by `aws-sdk-cpp`. Passive polling is preferred over active cancellation, since the latter would require to store a reference to the s3 meta request. The polling function is evaluated at the following points during the lifetime of the meta request: 1. _Request preparation_ (`aws_s3_meta_request_prepare_request`). 2. _Request update_ (the `.update` handler invoked via `aws_s3_meta_request_update`). 3. _Http stream completion_ (`.on_complete` handler invoking `aws_s3_meta_request_send_request_finish_default`). 4. _Writing download data_ (`aws_s3_meta_request_stream_response_body_synced`). If a `continue_callback` is provided and if it returns `false` at any of these 4 evaluation times, the meta request completes with the `error_code` `AWS_ERROR_S3_CANCELED`.
11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This restores an updated version of #238.
Rationale
Add a boolean
continue_callback, which polls a request-cancellation flag set by the user. This matches the use-case of theContinueRequestHandler/ContinueRequest/ShouldContinueboolean functions used byaws-sdk-cpp.Passive polling is preferred over active cancellation, since the latter would require to store a reference to the s3 meta request. The polling function is evaluated at the following points during the lifetime of the meta request:
aws_s3_meta_request_prepare_request)..updatehandler invoked viaaws_s3_meta_request_update)..on_completehandler invokingaws_s3_meta_request_send_request_finish_default).aws_s3_meta_request_stream_response_body_synced).If a
continue_callbackis provided and if it returnsfalseat any of these 4 evaluation times, the meta request completes with theerror_codeAWS_ERROR_S3_CANCELED.By using a boolean flag in the body of the function, the polling overhead can be kept minimal.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.