Debian Codegraph @

crt/aws-c-s3/include/aws/s3/private/s3_auto_ranged_get.h

raw symbols SCIP
1 #ifndef AWS_S3_AUTO_RANGED_GET_H
2 #define AWS_S3_AUTO_RANGED_GET_H
3
4 /**
5 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
6 * SPDX-License-Identifier: Apache-2.0.
7 */
8
9 #include "aws/s3/private/s3_meta_request_impl.h"
10
11 enum aws_s3_auto_ranged_get_request_type {
12 AWS_S3_AUTO_RANGE_GET_REQUEST_TYPE_HEAD_OBJECT,
13 AWS_S3_AUTO_RANGE_GET_REQUEST_TYPE_GET_OBJECT_WITH_RANGE,
14 AWS_S3_AUTO_RANGE_GET_REQUEST_TYPE_GET_OBJECT_WITH_PART_NUMBER_1,
15 };
16
17 struct aws_s3_auto_ranged_get {
18 struct aws_s3_meta_request base;
19
20 enum aws_s3_checksum_algorithm validation_algorithm;
21
22 struct aws_string *etag;
23
24 /* Estimated object stored part size based on ETag analysis */
25 uint64_t estimated_object_stored_part_size;
26 /* Number of parts stored in S3. We derive this from ETag, if ETag is not formatted as expected, this will be
27 * default to 1.
28 * Note: For S3Express Append, the object will be treated as a single part, even though, it can be multiple parts
29 * stored in S3.
30 */
31 uint64_t num_stored_parts;
32 /* Part size was set or not from user for this meta request. */
33 bool part_size_set;
34 bool force_dynamic_part_size;
35
36 bool initial_message_has_start_range;
37 bool initial_message_has_end_range;
38 uint64_t initial_range_start;
39 uint64_t initial_range_end;
40
41 uint64_t object_size_hint;
42 bool object_size_hint_available;
43
44 /* Members to only be used when the mutex in the base type is locked. */
45 struct {
46 /* The starting byte of the data that we will be retrieved from the object.
47 * (ignore this if object_range_empty) */
48 uint64_t object_range_start;
49
50 /* The last byte of the data that will be retrieved from the object.
51 * (ignore this if object_range_empty)
52 * Note this is inclusive: https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests
53 * So if begin=0 and end=0 then 1 byte is being downloaded. */
54 uint64_t object_range_end;
55
56 uint64_t first_part_size;
57
58 /* The total number of parts that are being used in downloading the object range. Note that "part" here
59 * currently refers to a range-get, and does not require a "part" on the service side. */
60 uint32_t total_num_parts;
61
62 uint32_t num_parts_requested;
63 uint32_t num_parts_completed;
64 uint32_t num_parts_successful;
65 uint32_t num_parts_failed;
66 uint32_t num_parts_checksum_validated;
67
68 uint32_t object_range_known : 1;
69
70 /* True if object_range_known, and it's found to be empty.
71 * If this is true, ignore object_range_start and object_range_end */
72 uint32_t object_range_empty : 1;
73 uint32_t head_object_sent : 1;
74 uint32_t head_object_completed : 1;
75 uint32_t read_window_warning_issued : 1;
76 } synced_data;
77
78 uint32_t initial_message_has_range_header : 1;
79 uint32_t initial_message_has_if_match_header : 1;
80 };
81
82 AWS_EXTERN_C_BEGIN
83
84 /* Creates a new auto-ranged get meta request. This will do multiple parallel ranged-gets when appropriate. */
85 AWS_S3_API struct aws_s3_meta_request *aws_s3_meta_request_auto_ranged_get_new(
86 struct aws_allocator *allocator,
87 struct aws_s3_client *client,
88 size_t part_size,
89 bool part_size_set,
90 const struct aws_s3_meta_request_options *options);
91
92 AWS_EXTERN_C_END
93
94 #endif /* AWS_S3_AUTO_RANGED_GET_H */