-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring meta request types (#79)
* aws_s3_request is now in its own header/source file. * All meta request types now get their own private header file to make writing tests for those easier. * Meta request types no longer use state machines for tracking what request is to be sent next. Instead, a series of conditions is evaluated each time next_request is called. * The final meta request result is now set with a success or fail function. Once all work that the meta request currently has in progress completes, then the meta request internally calls aws_s3_meta_request_finish, which invokes the finish callback. * Performance Behavior Improvement: added a mitigation for global request limit being hit. Client will first ask for new requests from meta requests with a "conservative" flag, which will cause auto-ranged-gets to limit the amount of requests returned, preventing parts from getting "backed up" waiting for earlier parts. * Bug fix: no header/body callbacks should now ever be invoked after the finish callback. * The client handles when a meta request is scheduled for work, instead of the meta request having to manage that at all.
- Loading branch information
Showing
21 changed files
with
1,958 additions
and
1,898 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#ifndef AWS_S3_AUTO_RANGED_GET_H | ||
#define AWS_S3_AUTO_RANGED_GET_H | ||
|
||
/** | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0. | ||
*/ | ||
|
||
#include "aws/s3/private/s3_meta_request_impl.h" | ||
|
||
enum aws_s3_auto_ranged_get_request_type { | ||
AWS_S3_AUTO_RANGE_GET_REQUEST_TYPE_PART, | ||
}; | ||
|
||
struct aws_s3_auto_ranged_get { | ||
struct aws_s3_meta_request base; | ||
|
||
/* Members to only be used when the mutex in the base type is locked. */ | ||
struct { | ||
uint32_t total_num_parts; | ||
|
||
uint32_t num_parts_requested; | ||
uint32_t num_parts_completed; | ||
uint32_t num_parts_successful; | ||
uint32_t num_parts_failed; | ||
|
||
size_t total_object_size; | ||
|
||
} synced_data; | ||
}; | ||
|
||
/* Creates a new auto-ranged get meta request. This will do multiple parallel ranged-gets when appropriate. */ | ||
struct aws_s3_meta_request *aws_s3_meta_request_auto_ranged_get_new( | ||
struct aws_allocator *allocator, | ||
struct aws_s3_client *client, | ||
size_t part_size, | ||
const struct aws_s3_meta_request_options *options); | ||
|
||
#endif |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#ifndef AWS_S3_DEFAULT_META_REQUEST_H | ||
#define AWS_S3_DEFAULT_META_REQUEST_H | ||
|
||
/** | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0. | ||
*/ | ||
|
||
#include "aws/s3/private/s3_meta_request_impl.h" | ||
|
||
struct aws_s3_client; | ||
|
||
struct aws_s3_meta_request_default { | ||
struct aws_s3_meta_request base; | ||
|
||
size_t content_length; | ||
|
||
/* Members to only be used when the mutex in the base type is locked. */ | ||
struct { | ||
int cached_response_status; | ||
int request_error_code; | ||
|
||
uint32_t request_sent : 1; | ||
uint32_t request_completed : 1; | ||
|
||
} synced_data; | ||
}; | ||
|
||
/* Creates a new default meta request. This will send the request as is and pass back the response. */ | ||
struct aws_s3_meta_request *aws_s3_meta_request_default_new( | ||
struct aws_allocator *allocator, | ||
struct aws_s3_client *client, | ||
uint64_t content_length, | ||
const struct aws_s3_meta_request_options *options); | ||
|
||
#endif |
Oops, something went wrong.