|
Apache OpenDALâ„¢ C Binding
The C binding for Apache OpenDALâ„¢
|
Options for copy operations. More...
#include <opendal.h>
Public Attributes | |
| bool | if_not_exists |
| const char * | if_match |
| const char * | source_version |
| bool | has_source_content_length_hint |
| uint64_t | source_content_length_hint |
| uintptr_t | concurrent |
| bool | has_chunk |
| uintptr_t | chunk |
Options for copy operations.
Each condition checks the destination file, never the source, and every condition must hold for the copy to proceed:
See the conditional operation specification for the complete cross-operation contract.
Use opendal_copy_options_new() to construct and opendal_copy_options_free() to free.
A caller that declares the struct itself must initialize every member, for example with opendal_copy_options opts = {0};, because a function that takes these options reads every member, also one whose has_* member is false.
| uintptr_t opendal_copy_options::chunk |
Sets chunk size for segmented copy operations.
Check opendal_capability.copy_can_multi, opendal_capability.copy_multi_min_size and opendal_capability.copy_multi_max_size before using this feature.
This is a best-effort execution option. Services that support server-side segmented copy can use it as the target size for each copy step. Services that cannot split copy operations can ignore it. 0 has the same behavior as leaving it unset.
has_chunk controls whether this value applies.
| uintptr_t opendal_copy_options::concurrent |
Sets concurrent copy operations for opendal_operator_copy_with() and for the copier from opendal_operator_copier_with().
This is a best-effort execution option. Services that cannot split copy into concurrent server-side tasks can ignore it. 0 has the same behavior as 1.
0 is the default.
| bool opendal_copy_options::has_chunk |
Whether chunk has been set.
| bool opendal_copy_options::has_source_content_length_hint |
Whether source_content_length_hint has been set.
| const char* opendal_copy_options::if_match |
Copy only when the destination file has this exact ETag.
The condition succeeds when the destination file exists and its ETag equals this value. A destination file with a different ETag, or a missing destination file, fails the copy with OPENDAL_CONDITION_NOT_MATCH. Only concrete ETag values are portable; a wildcard such as "*" has no portable meaning here.
The operation returns OPENDAL_UNSUPPORTED when the service does not advertise opendal_capability.copy_with_if_match.
NULL means unset. A non-NULL value must point to a readable, nul-terminated UTF-8 string. opendal_copy_options_set_if_match() stores this pointer without copying the string, and opendal_copy_options_free() does not free it, so the string must stay valid until the function that takes these options returns.
| bool opendal_copy_options::if_not_exists |
Copy only when no file exists at the destination path.
The condition succeeds when the destination path is empty, so the copy creates the destination file. An existing destination file fails the copy with OPENDAL_CONDITION_NOT_MATCH.
The operation returns OPENDAL_UNSUPPORTED when the service does not advertise opendal_capability.copy_with_if_not_exists.
| uint64_t opendal_copy_options::source_content_length_hint |
Asserted complete content length of the source object.
OpenDAL may trust this value without reading source metadata. It can use the value to plan copied ranges. An incorrect value can therefore cause incomplete copy planning or failed requests. For example, on s3 with chunk set, OpenDAL clamps chunk to opendal_capability.copy_multi_min_size and opendal_capability.copy_multi_max_size to determine the effective part size. OpenDAL plans multipart ranges from the hint when it is at least that size. With a hint below the source length, the multipart copy can succeed with only that many bytes at the destination. A hint above the source length fails the multipart copy. With a hint below the effective part size, s3 attempts a whole-object copy in one request. The fs service ignores the hint.
This option does not pin the source object or protect the copy from a concurrent source change. Set it only when the caller can guarantee that the value describes the object that the service will copy, for example by selecting an immutable source_version. Otherwise omit it if the source can change.
has_source_content_length_hint controls whether this value applies.
| const char* opendal_copy_options::source_version |
Copy from a specific source file version.
This selects which stored version of the source the copy reads; it is not a condition on the destination file. Destination behavior follows normal copy semantics.
Check opendal_capability.copy_with_source_version before using this option.
NULL means unset. A non-NULL value must point to a readable, nul-terminated UTF-8 string. opendal_copy_options_set_source_version() stores this pointer without copying the string, and opendal_copy_options_free() does not free it, so the string must stay valid until the function that takes these options returns.