Debian Codegraph @

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

raw symbols SCIP
1 #ifndef AWS_S3_H
2 #define AWS_S3_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/common/common.h>
10 #include <aws/io/logging.h>
11 #include <aws/s3/exports.h>
12
13 AWS_PUSH_SANE_WARNING_LEVEL
14
15 #define AWS_C_S3_PACKAGE_ID 14
16
17 enum aws_s3_errors {
18 AWS_ERROR_S3_MISSING_CONTENT_RANGE_HEADER = AWS_ERROR_ENUM_BEGIN_RANGE(AWS_C_S3_PACKAGE_ID),
19 AWS_ERROR_S3_INVALID_CONTENT_RANGE_HEADER,
20 AWS_ERROR_S3_MISSING_CONTENT_LENGTH_HEADER,
21 AWS_ERROR_S3_INVALID_CONTENT_LENGTH_HEADER,
22 AWS_ERROR_S3_MISSING_ETAG,
23 AWS_ERROR_S3_INTERNAL_ERROR,
24 AWS_ERROR_S3_SLOW_DOWN,
25 AWS_ERROR_S3_INVALID_RESPONSE_STATUS,
26 AWS_ERROR_S3_MISSING_UPLOAD_ID,
27 AWS_ERROR_S3_PROXY_PARSE_FAILED,
28 AWS_ERROR_S3_UNSUPPORTED_PROXY_SCHEME,
29 AWS_ERROR_S3_CANCELED,
30 AWS_ERROR_S3_INVALID_RANGE_HEADER,
31 AWS_ERROR_S3_MULTIRANGE_HEADER_UNSUPPORTED,
32 AWS_ERROR_S3_RESPONSE_CHECKSUM_MISMATCH,
33 AWS_ERROR_S3_CHECKSUM_CALCULATION_FAILED,
34 AWS_ERROR_S3_PAUSED,
35 AWS_ERROR_S3_LIST_PARTS_PARSE_FAILED,
36 AWS_ERROR_S3_RESUMED_PART_CHECKSUM_MISMATCH,
37 AWS_ERROR_S3_RESUME_FAILED,
38 AWS_ERROR_S3_OBJECT_MODIFIED,
39 AWS_ERROR_S3_NON_RECOVERABLE_ASYNC_ERROR,
40 AWS_ERROR_S3_METRIC_DATA_NOT_AVAILABLE,
41 AWS_ERROR_S3_INCORRECT_CONTENT_LENGTH,
42 AWS_ERROR_S3_REQUEST_TIME_TOO_SKEWED,
43 AWS_ERROR_S3_FILE_MODIFIED,
44 AWS_ERROR_S3_EXCEEDS_MEMORY_LIMIT,
45 AWS_ERROR_S3_INVALID_MEMORY_LIMIT_CONFIG,
46 AWS_ERROR_S3EXPRESS_CREATE_SESSION_FAILED,
47 AWS_ERROR_S3_INTERNAL_BUFFER_SIZE_MISMATCH_RETRYING_WITH_RANGE,
48 AWS_ERROR_S3_REQUEST_HAS_COMPLETED,
49 AWS_ERROR_S3_RECV_FILE_ALREADY_EXISTS,
50 AWS_ERROR_S3_RECV_FILE_NOT_FOUND,
51 AWS_ERROR_S3_REQUEST_TIMEOUT,
52 AWS_ERROR_S3_BUFFER_ALLOCATION_FAILED,
53
54 AWS_ERROR_S3_END_RANGE = AWS_ERROR_ENUM_END_RANGE(AWS_C_S3_PACKAGE_ID)
55 };
56
57 enum aws_s3_subject {
58 AWS_LS_S3_GENERAL = AWS_LOG_SUBJECT_BEGIN_RANGE(AWS_C_S3_PACKAGE_ID),
59 AWS_LS_S3_CLIENT,
60 AWS_LS_S3_CLIENT_STATS,
61 AWS_LS_S3_REQUEST,
62 AWS_LS_S3_META_REQUEST,
63 AWS_LS_S3_ENDPOINT,
64 AWS_LS_S3_LAST = AWS_LOG_SUBJECT_END_RANGE(AWS_C_S3_PACKAGE_ID)
65 };
66
67 struct aws_s3_platform_info;
68
69 #ifdef _MSC_VER
70 # pragma warning(push)
71 # pragma warning(disable : 4626) /* assignment operator was implicitly defined as deleted */
72 # pragma warning(disable : 5027) /* move assignment operator was implicitly defined as deleted */
73 #endif
74
75 struct aws_s3_platform_info {
76 /* name of the instance-type: example c5n.18xlarge */
77 struct aws_byte_cursor instance_type;
78 /* max throughput for this instance type, in gigabits per second */
79 double max_throughput_gbps;
80 /* Whether this library recommends automatically applying its optimized
81 * configuration for this instance type without explicit user opt-in. */
82 bool has_recommended_configuration;
83 };
84
85 #ifdef _MSC_VER
86 # pragma warning(pop)
87 #endif
88
89 AWS_EXTERN_C_BEGIN
90
91 /**
92 * Initializes internal datastructures used by aws-c-s3.
93 * Must be called before using any functionality in aws-c-s3.
94 */
95 AWS_S3_API
96 void aws_s3_library_init(struct aws_allocator *allocator);
97
98 /**
99 * Shuts down the internal datastructures used by aws-c-s3.
100 */
101 AWS_S3_API
102 void aws_s3_library_clean_up(void);
103
104 /*
105 * Returns the aws_s3_platform_info for current platform
106 * NOTE: THIS API IS EXPERIMENTAL AND UNSTABLE
107 */
108 AWS_S3_API
109 const struct aws_s3_platform_info *aws_s3_get_current_platform_info(void);
110
111 /*
112 * Returns the ec2 instance_type for current platform if possible
113 * NOTE: THIS API IS EXPERIMENTAL AND UNSTABLE
114 */
115 AWS_S3_API
116 struct aws_byte_cursor aws_s3_get_current_platform_ec2_intance_type(bool cached_only);
117
118 /*
119 * Retrieves a list of EC2 instance types with recommended configuration.
120 * Returns aws_array_list<aws_byte_cursor>. The caller is responsible for cleaning up the array list.
121 */
122 AWS_S3_API
123 struct aws_array_list aws_s3_get_platforms_with_recommended_config(void);
124
125 AWS_EXTERN_C_END
126 AWS_POP_SANE_WARNING_LEVEL
127
128 #endif /* AWS_S3_H */