Debian Codegraph @

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

raw symbols SCIP
1 #ifndef AWS_S3_COPY_OBJECT_H
2 #define AWS_S3_COPY_OBJECT_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 #include <aws/common/uri.h>
11
12 enum aws_s3_copy_object_request_tag {
13 AWS_S3_COPY_OBJECT_REQUEST_TAG_GET_OBJECT_SIZE,
14 AWS_S3_COPY_OBJECT_REQUEST_TAG_BYPASS,
15 AWS_S3_COPY_OBJECT_REQUEST_TAG_CREATE_MULTIPART_UPLOAD,
16 AWS_S3_COPY_OBJECT_REQUEST_TAG_MULTIPART_COPY,
17 AWS_S3_COPY_OBJECT_REQUEST_TAG_ABORT_MULTIPART_UPLOAD,
18 AWS_S3_COPY_OBJECT_REQUEST_TAG_COMPLETE_MULTIPART_UPLOAD,
19
20 AWS_S3_COPY_OBJECT_REQUEST_TAG_MAX,
21 };
22
23 struct aws_s3_copy_object {
24 struct aws_s3_meta_request base;
25
26 /* Usable after the Create Multipart Upload request succeeds. */
27 struct aws_string *upload_id;
28
29 /* (Optional) source_uri for the copy operation. */
30 struct aws_uri source_uri;
31
32 /* Only meant for use in the update function, which is never called concurrently. */
33 struct {
34 uint32_t next_part_number;
35 } threaded_update_data;
36
37 /* Members to only be used when the mutex in the base type is locked. */
38 struct {
39 /* Array-list of `struct aws_s3_mpu_part_info *`.
40 * If copying via multipart upload, we fill in this info as each part gets copied,
41 * and it's used to generate the final CompleteMultipartUpload. */
42 struct aws_array_list part_list;
43
44 /* obtained through a HEAD request against the source object */
45 uint64_t content_length;
46 size_t part_size;
47
48 uint32_t total_num_parts;
49 uint32_t num_parts_sent;
50 uint32_t num_parts_completed;
51 uint32_t num_parts_successful;
52 uint32_t num_parts_failed;
53
54 struct aws_http_headers *needed_response_headers;
55
56 int create_multipart_upload_error_code;
57 int complete_multipart_upload_error_code;
58 int abort_multipart_upload_error_code;
59
60 uint32_t head_object_sent : 1;
61 uint32_t head_object_completed : 1;
62 uint32_t copy_request_bypass_sent : 1;
63 uint32_t copy_request_bypass_completed : 1;
64 uint32_t create_multipart_upload_sent : 1;
65 uint32_t create_multipart_upload_completed : 1;
66 uint32_t complete_multipart_upload_sent : 1;
67 uint32_t complete_multipart_upload_completed : 1;
68 uint32_t abort_multipart_upload_sent : 1;
69 uint32_t abort_multipart_upload_completed : 1;
70
71 } synced_data;
72 };
73
74 /* Creates a new CopyObject meta request. This will perform either
75 * 1) A CopyObject S3 API call if the source object length is < 1 GB or
76 * 2) a multipart copy in parallel otherwise.
77 */
78 struct aws_s3_meta_request *aws_s3_meta_request_copy_object_new(
79 struct aws_allocator *allocator,
80 struct aws_s3_client *client,
81 const struct aws_s3_meta_request_options *options);
82
83 #endif