|
Apache OpenDALâ„¢ C Binding
The C binding for Apache OpenDALâ„¢
|
#include <stdint.h>#include <stddef.h>#include <stdbool.h>Go to the source code of this file.
Classes | |
| struct | opendal_cancel_token |
| An opaque, thread-safe token used to cancel in-flight OpenDAL operations. More... | |
| struct | opendal_bytes |
| opendal_bytes carries raw-bytes with its length More... | |
| struct | opendal_error |
| The opendal error type for C binding, containing an error code and corresponding error message. More... | |
| struct | opendal_lister |
| Lister is designed to list entries at a given path in a blocking manner. More... | |
| struct | opendal_entry |
| opendal_list_entry is the entry under a path, which is listed from the opendal_lister More... | |
| struct | opendal_operator_layers |
| The layers to apply when initializing an opendal_operator. More... | |
| struct | opendal_metadata |
| Carries all metadata associated with a path. More... | |
| struct | opendal_metadata_user_metadata |
| User metadata associated with a path. More... | |
| struct | opendal_metadata_user_metadata_pair |
| A user metadata key-value pair. More... | |
| struct | opendal_operator |
| Used to access almost all OpenDAL APIs. It represents an operator that provides the unified interfaces provided by OpenDAL. More... | |
| struct | opendal_operator_options |
| The configuration for the initialization of opendal_operator. More... | |
| struct | opendal_write_user_metadata_pair |
| A key-value pair for write user metadata. More... | |
| struct | opendal_write_options |
| Options for write operations. More... | |
| struct | opendal_read_options |
| Options for read operations. More... | |
| struct | opendal_reader |
| The result type returned by opendal's reader operation. More... | |
| struct | opendal_reader_options |
| Options for reader operations. More... | |
| struct | opendal_writer |
| The result type returned by opendal's writer operation. More... | |
| struct | opendal_delete_options |
| Options for delete operations. More... | |
| struct | opendal_stat_options |
| Options for stat operations. More... | |
| struct | opendal_list_options |
| Options for list operations. More... | |
| struct | opendal_copy_options |
| Options for copy operations. More... | |
| struct | opendal_copier |
| opendal_copier completes a long-running copy operation to completion in a blocking manner. opendal_copier repeatedly calls a copy operation until completion. More... | |
| struct | opendal_deleter |
| opendal_deleter removes many paths from storage. More... | |
| struct | opendal_operator_info |
| Metadata for operator, users can use this metadata to get information of operator. More... | |
| struct | opendal_capability |
| Capability is used to describe what operations are supported by current Operator. More... | |
| struct | opendal_presigned_request |
| The underlying presigned request, which contains the HTTP method, URI, and headers. This is an opaque struct, please use the accessor functions to get the fields. More... | |
| struct | opendal_http_header_pair |
| The key-value pair for the headers of the presigned request. More... | |
Macros | |
| #define | OPENDAL_SEEK_SET 0 |
| #define | OPENDAL_SEEK_CUR 1 |
| #define | OPENDAL_SEEK_END 2 |
Typedefs | |
| typedef enum opendal_code | opendal_code |
| The error code for all opendal APIs in C binding. | |
| typedef struct opendal_presigned_request_inner | opendal_presigned_request_inner |
| typedef struct opendal_cancel_token | opendal_cancel_token |
| An opaque, thread-safe token used to cancel in-flight OpenDAL operations. | |
| typedef struct opendal_bytes | opendal_bytes |
| opendal_bytes carries raw-bytes with its length | |
| typedef struct opendal_error | opendal_error |
| The opendal error type for C binding, containing an error code and corresponding error message. | |
| typedef struct opendal_lister | opendal_lister |
| Lister is designed to list entries at a given path in a blocking manner. | |
| typedef struct opendal_entry | opendal_entry |
| opendal_list_entry is the entry under a path, which is listed from the opendal_lister | |
| typedef void(* | opendal_log_callback) (int32_t level, const char *file, uint32_t line, const char *message) |
| typedef struct opendal_operator_layers | opendal_operator_layers |
| The layers to apply when initializing an opendal_operator. | |
| typedef struct opendal_metadata | opendal_metadata |
| Carries all metadata associated with a path. | |
| typedef struct opendal_metadata_user_metadata | opendal_metadata_user_metadata |
| User metadata associated with a path. | |
| typedef struct opendal_metadata_user_metadata_pair | opendal_metadata_user_metadata_pair |
| A user metadata key-value pair. | |
| typedef struct opendal_operator | opendal_operator |
| Used to access almost all OpenDAL APIs. It represents an operator that provides the unified interfaces provided by OpenDAL. | |
| typedef struct opendal_operator_options | opendal_operator_options |
| The configuration for the initialization of opendal_operator. | |
| typedef struct opendal_write_user_metadata_pair | opendal_write_user_metadata_pair |
| A key-value pair for write user metadata. | |
| typedef struct opendal_write_options | opendal_write_options |
| Options for write operations. | |
| typedef struct opendal_read_options | opendal_read_options |
| Options for read operations. | |
| typedef struct opendal_reader | opendal_reader |
| The result type returned by opendal's reader operation. | |
| typedef struct opendal_reader_options | opendal_reader_options |
| Options for reader operations. | |
| typedef struct opendal_writer | opendal_writer |
| The result type returned by opendal's writer operation. | |
| typedef struct opendal_delete_options | opendal_delete_options |
| Options for delete operations. | |
| typedef struct opendal_stat_options | opendal_stat_options |
| Options for stat operations. | |
| typedef struct opendal_list_options | opendal_list_options |
| Options for list operations. | |
| typedef struct opendal_copy_options | opendal_copy_options |
| Options for copy operations. | |
| typedef struct opendal_copier | opendal_copier |
| opendal_copier completes a long-running copy operation to completion in a blocking manner. opendal_copier repeatedly calls a copy operation until completion. | |
| typedef struct opendal_deleter | opendal_deleter |
| opendal_deleter removes many paths from storage. | |
| typedef struct opendal_operator_info | opendal_operator_info |
| Metadata for operator, users can use this metadata to get information of operator. | |
| typedef struct opendal_capability | opendal_capability |
| Capability is used to describe what operations are supported by current Operator. | |
| typedef struct opendal_presigned_request | opendal_presigned_request |
| The underlying presigned request, which contains the HTTP method, URI, and headers. This is an opaque struct, please use the accessor functions to get the fields. | |
| typedef struct opendal_http_header_pair | opendal_http_header_pair |
| The key-value pair for the headers of the presigned request. | |
Enumerations | |
| enum | opendal_code { OPENDAL_UNEXPECTED , OPENDAL_UNSUPPORTED , OPENDAL_CONFIG_INVALID , OPENDAL_NOT_FOUND , OPENDAL_PERMISSION_DENIED , OPENDAL_IS_A_DIRECTORY , OPENDAL_NOT_A_DIRECTORY , OPENDAL_ALREADY_EXISTS , OPENDAL_RATE_LIMITED , OPENDAL_IS_SAME_FILE , OPENDAL_CONDITION_NOT_MATCH , OPENDAL_RANGE_NOT_SATISFIED , OPENDAL_CONFLICT , OPENDAL_CANCELLED , OPENDAL_CHECKSUM_MISMATCH } |
| The error code for all opendal APIs in C binding. More... | |
Functions | |
| uint32_t | opendal_c_abi_version (void) |
| uintptr_t | opendal_c_capability_size (void) |
| const char * | opendal_c_version (void) |
| struct opendal_cancel_token * | opendal_cancel_token_new (void) |
| Allocate a new uncancelled opendal_cancel_token. | |
| void | opendal_cancel_token_cancel (const struct opendal_cancel_token *token) |
| Signal cancellation on token. | |
| bool | opendal_cancel_token_is_cancelled (const struct opendal_cancel_token *token) |
| Return whether token has been cancelled. | |
| void | opendal_cancel_token_free (struct opendal_cancel_token *token) |
| Free the heap memory used by opendal_cancel_token. | |
| void | opendal_error_free (struct opendal_error *ptr) |
| Frees the opendal_error, ok to call on NULL. | |
| struct opendal_error * | opendal_lister_next (struct opendal_lister *self, struct opendal_entry **entry) |
| Return the next object to be listed. | |
| struct opendal_error * | opendal_lister_next_with_cancel (struct opendal_lister *self, const struct opendal_cancel_token *cancel, struct opendal_entry **entry) |
| Return the next object to be listed, supporting cancellation via cancel. | |
| void | opendal_lister_free (struct opendal_lister *ptr) |
| Free the heap-allocated metadata used by opendal_lister. | |
| struct opendal_error * | opendal_logging_init (opendal_log_callback callback) |
| Installs one process-global native callback for the library's Rust log facade. | |
| struct opendal_operator_layers * | opendal_operator_layers_new (void) |
| Construct a heap-allocated opendal_operator_layers. | |
| void | opendal_operator_layers_add_retry (struct opendal_operator_layers *layers, bool jitter, float factor, uint64_t min_delay_ns, uint64_t max_delay_ns, uint64_t max_times) |
| Add a retry layer. | |
| void | opendal_operator_layers_add_timeout (struct opendal_operator_layers *layers, uint64_t timeout_ns, uint64_t io_timeout_ns) |
| Add a timeout layer. | |
| void | opendal_operator_layers_free (struct opendal_operator_layers *ptr) |
| Free the allocated memory used by opendal_operator_layers. | |
| void | opendal_metadata_free (struct opendal_metadata *ptr) |
| Free the heap-allocated metadata used by opendal_metadata. | |
| uint8_t | opendal_metadata_mode (const struct opendal_metadata *self) |
| Return this entry's mode. | |
| uint8_t | opendal_metadata_is_current (const struct opendal_metadata *self) |
| Return whether this metadata describes the current object version. | |
| bool | opendal_metadata_is_deleted (const struct opendal_metadata *self) |
| Return whether this metadata describes a deleted object or delete marker. | |
| char * | opendal_metadata_cache_control (const struct opendal_metadata *self) |
| Return this entry's Cache-Control value. | |
| uint64_t | opendal_metadata_content_length (const struct opendal_metadata *self) |
| Return the full content length of this entry. | |
| char * | opendal_metadata_content_md5 (const struct opendal_metadata *self) |
| Return this entry's Content-MD5 value. | |
| char * | opendal_metadata_content_type (const struct opendal_metadata *self) |
| Return this entry's Content-Type value. | |
| char * | opendal_metadata_content_encoding (const struct opendal_metadata *self) |
| Return this entry's Content-Encoding value. | |
| char * | opendal_metadata_content_language (const struct opendal_metadata *self) |
| Return this entry's Content-Language value, if available. | |
| int64_t | opendal_metadata_last_modified_ms (const struct opendal_metadata *self) |
| Return this entry's Last-Modified timestamp. | |
| char * | opendal_metadata_etag (const struct opendal_metadata *self) |
| Return this entry's service-provided ETag as-is. | |
| char * | opendal_metadata_content_disposition (const struct opendal_metadata *self) |
| Return this entry's Content-Disposition value. | |
| char * | opendal_metadata_version (const struct opendal_metadata *self) |
| Return this entry's service-specific version identifier. | |
| struct opendal_metadata_user_metadata * | opendal_metadata_get_user_metadata (const struct opendal_metadata *self) |
| Return the user metadata of the metadata. | |
| bool | opendal_metadata_is_file (const struct opendal_metadata *self) |
| Return whether the path represents a file. | |
| bool | opendal_metadata_is_dir (const struct opendal_metadata *self) |
| Return whether the path represents a directory. | |
| const struct opendal_metadata_user_metadata_pair * | opendal_metadata_user_metadata_pairs (const struct opendal_metadata_user_metadata *metadata) |
| Return the key-value pairs of the user metadata. | |
| uintptr_t | opendal_metadata_user_metadata_len (const struct opendal_metadata_user_metadata *metadata) |
| Return the number of key-value pairs in the user metadata. | |
| void | opendal_metadata_user_metadata_free (struct opendal_metadata_user_metadata *metadata) |
| Free the user metadata returned by opendal_metadata_user_metadata. | |
| void | opendal_operator_free (const struct opendal_operator *ptr) |
| Free the heap-allocated operator pointed by opendal_operator. | |
| struct opendal_error * | opendal_operator_new (const char *scheme, const struct opendal_operator_options *options, struct opendal_operator **op) |
| Construct an operator based on scheme and options. | |
| struct opendal_error * | opendal_operator_new_with_layers (const char *scheme, const struct opendal_operator_options *options, const struct opendal_operator_layers *layers, struct opendal_operator **op) |
| Construct an operator based on scheme, options, and explicit layers. | |
| struct opendal_error * | opendal_operator_write (const struct opendal_operator *op, const char *path, const struct opendal_bytes *bytes) |
| Blocking write raw bytes to path. | |
| struct opendal_error * | opendal_operator_write_with (const struct opendal_operator *op, const char *path, const struct opendal_bytes *bytes, const struct opendal_write_options *opts) |
| Blocking write raw bytes to path with options. | |
| struct opendal_error * | opendal_operator_write_with_metadata (const struct opendal_operator *op, const char *path, const struct opendal_bytes *bytes, const struct opendal_write_options *opts, struct opendal_metadata **meta) |
| Blocking write raw bytes to path, returning the written object's metadata. | |
| struct opendal_error * | opendal_operator_write_with_cancel (const struct opendal_operator *op, const char *path, const struct opendal_bytes *bytes, const struct opendal_write_options *opts, const struct opendal_cancel_token *cancel, struct opendal_metadata **meta) |
| Blocking write raw bytes to path with options, optional cancellation, and optional metadata output. | |
| struct opendal_error * | opendal_operator_read (const struct opendal_operator *op, const char *path, struct opendal_bytes *bytes) |
| Blocking read the data from path. | |
| struct opendal_error * | opendal_operator_read_with (const struct opendal_operator *op, const char *path, const struct opendal_read_options *opts, struct opendal_bytes *bytes) |
| Blocking read the data from path with options. | |
| struct opendal_error * | opendal_operator_read_with_cancel (const struct opendal_operator *op, const char *path, const struct opendal_read_options *opts, const struct opendal_cancel_token *cancel, struct opendal_bytes *bytes) |
| Blocking read the data from path with options and optional cancellation. | |
| struct opendal_error * | opendal_operator_reader (const struct opendal_operator *op, const char *path, struct opendal_reader **reader) |
| Blocking create a reader for the specified path. | |
| struct opendal_error * | opendal_operator_reader_with (const struct opendal_operator *op, const char *path, const struct opendal_reader_options *opts, struct opendal_reader **reader) |
| Blocking create a reader for the specified path with options. | |
| struct opendal_error * | opendal_operator_reader_with_cancel (const struct opendal_operator *op, const char *path, const struct opendal_reader_options *opts, const struct opendal_cancel_token *cancel, struct opendal_reader **reader) |
| Blocking create a reader for the specified path with options and optional cancellation. | |
| struct opendal_error * | opendal_operator_writer (const struct opendal_operator *op, const char *path, struct opendal_writer **writer) |
| Blocking create a writer for the specified path. | |
| struct opendal_error * | opendal_operator_writer_with (const struct opendal_operator *op, const char *path, const struct opendal_write_options *opts, struct opendal_writer **writer) |
| Blocking create a writer for the specified path with options. | |
| struct opendal_error * | opendal_operator_writer_with_cancel (const struct opendal_operator *op, const char *path, const struct opendal_write_options *opts, const struct opendal_cancel_token *cancel, struct opendal_writer **writer) |
| Blocking create a writer for the specified path with options and optional cancellation. | |
| struct opendal_error * | opendal_operator_delete (const struct opendal_operator *op, const char *path) |
| Blocking delete the object in path. | |
| struct opendal_error * | opendal_operator_delete_with (const struct opendal_operator *op, const char *path, const struct opendal_delete_options *opts) |
| Blocking delete the object in path with options. | |
| struct opendal_error * | opendal_operator_delete_with_cancel (const struct opendal_operator *op, const char *path, const struct opendal_delete_options *opts, const struct opendal_cancel_token *cancel) |
| Blocking delete the object in path with options and optional cancellation. | |
| struct opendal_error * | opendal_operator_is_exist (const struct opendal_operator *op, const char *path, bool *is_exist) |
| Check whether the path exists. | |
| struct opendal_error * | opendal_operator_exists (const struct opendal_operator *op, const char *path, bool *exists) |
| Check whether the path exists. | |
| struct opendal_error * | opendal_operator_exists_with_cancel (const struct opendal_operator *op, const char *path, const struct opendal_cancel_token *cancel, bool *exists) |
| Check whether the path exists, supporting optional cancellation via cancel. | |
| struct opendal_error * | opendal_operator_stat (const struct opendal_operator *op, const char *path, struct opendal_metadata **meta) |
| Stat the path, return its metadata. | |
| struct opendal_error * | opendal_operator_stat_with (const struct opendal_operator *op, const char *path, const struct opendal_stat_options *opts, struct opendal_metadata **meta) |
| Blocking stat the object in path with options. | |
| struct opendal_error * | opendal_operator_stat_with_cancel (const struct opendal_operator *op, const char *path, const struct opendal_stat_options *opts, const struct opendal_cancel_token *cancel, struct opendal_metadata **meta) |
| Blocking stat the object in path with options and optional cancellation. | |
| struct opendal_error * | opendal_operator_list (const struct opendal_operator *op, const char *path, struct opendal_lister **lister) |
| Blocking list the objects in path. | |
| struct opendal_error * | opendal_operator_list_with (const struct opendal_operator *op, const char *path, const struct opendal_list_options *opts, struct opendal_lister **lister) |
| Blocking list the objects in path with options. | |
| struct opendal_error * | opendal_operator_list_with_cancel (const struct opendal_operator *op, const char *path, const struct opendal_list_options *opts, const struct opendal_cancel_token *cancel, struct opendal_lister **lister) |
| Blocking list the objects in path with options and optional cancellation. | |
| struct opendal_error * | opendal_operator_create_dir (const struct opendal_operator *op, const char *path) |
| Blocking create the directory in path. | |
| struct opendal_error * | opendal_operator_create_dir_with_cancel (const struct opendal_operator *op, const char *path, const struct opendal_cancel_token *cancel) |
| Blocking create the directory in path with optional cancellation. | |
| struct opendal_error * | opendal_operator_rename (const struct opendal_operator *op, const char *src, const char *dest) |
| Blocking rename the object in path. | |
| struct opendal_error * | opendal_operator_rename_with_cancel (const struct opendal_operator *op, const char *src, const char *dest, const struct opendal_cancel_token *cancel) |
| Blocking rename the object from src to dest with optional cancellation. | |
| struct opendal_error * | opendal_operator_copy (const struct opendal_operator *op, const char *src, const char *dest) |
| Blocking copy the object in path. | |
| struct opendal_error * | opendal_operator_copy_with (const struct opendal_operator *op, const char *src, const char *dest, const struct opendal_copy_options *opts) |
| Blocking copy the object in path with options. | |
| struct opendal_error * | opendal_operator_copy_with_cancel (const struct opendal_operator *op, const char *src, const char *dest, const struct opendal_copy_options *opts, const struct opendal_cancel_token *cancel) |
| Blocking copy the object from src to dest with options and optional cancellation. | |
| struct opendal_error * | opendal_operator_check (const struct opendal_operator *op) |
| Check whether the operator works properly. | |
| struct opendal_error * | opendal_operator_check_with_cancel (const struct opendal_operator *op, const struct opendal_cancel_token *cancel) |
| Check whether the operator works properly, supporting optional cancellation. | |
| struct opendal_error * | opendal_operator_copier (const struct opendal_operator *op, const char *src, const char *dest, struct opendal_copier **copier) |
| Blocking create a copier to copy a file from src to dest. | |
| struct opendal_error * | opendal_operator_copier_with (const struct opendal_operator *op, const char *src, const char *dest, const struct opendal_copy_options *opts, struct opendal_copier **copier) |
| Blocking create a copier to copy a file from src to dest with options. | |
| struct opendal_error * | opendal_operator_copier_with_cancel (const struct opendal_operator *op, const char *src, const char *dest, const struct opendal_copy_options *opts, const struct opendal_cancel_token *cancel, struct opendal_copier **copier) |
| Blocking create a copier to copy a file from src to dest with options and optional cancellation. | |
| struct opendal_error * | opendal_operator_deleter (const struct opendal_operator *op, struct opendal_deleter **deleter_out) |
| Create a blocking deleter to remove multiple paths. | |
| struct opendal_error * | opendal_operator_deleter_with_cancel (const struct opendal_operator *op, const struct opendal_cancel_token *cancel, struct opendal_deleter **deleter_out) |
| Create a blocking deleter to remove multiple paths, supporting optional cancellation. | |
| struct opendal_operator_info * | opendal_operator_info_new (const struct opendal_operator *op) |
| Get information of underlying accessor. | |
| void | opendal_operator_info_free (struct opendal_operator_info *ptr) |
| Free the heap-allocated opendal_operator_info. | |
| char * | opendal_operator_info_get_scheme (const struct opendal_operator_info *self) |
| Return the nul-terminated operator's scheme, i.e. service. | |
| char * | opendal_operator_info_get_root (const struct opendal_operator_info *self) |
| Return the nul-terminated operator's working root path. | |
| char * | opendal_operator_info_get_name (const struct opendal_operator_info *self) |
| Return the nul-terminated operator backend's name, could be empty if underlying backend has no namespace concept. | |
| void | opendal_operator_info_get_capability (const struct opendal_operator_info *self, struct opendal_capability *cap) |
| Write the operator's capability into cap. | |
| struct opendal_error * | opendal_operator_presign_read (const struct opendal_operator *op, const char *path, uint64_t expire_secs, struct opendal_presigned_request **req) |
| Presign a read operation. | |
| struct opendal_error * | opendal_operator_presign_read_with (const struct opendal_operator *op, const char *path, uint64_t expire_secs, const struct opendal_read_options *opts, struct opendal_presigned_request **req) |
| Presign a read operation with options. | |
| struct opendal_error * | opendal_operator_presign_read_with_cancel (const struct opendal_operator *op, const char *path, uint64_t expire_secs, const struct opendal_read_options *opts, const struct opendal_cancel_token *cancel, struct opendal_presigned_request **req) |
| Presign a read operation with options and optional cancellation. | |
| struct opendal_error * | opendal_operator_presign_write (const struct opendal_operator *op, const char *path, uint64_t expire_secs, struct opendal_presigned_request **req) |
| Presign a write operation. | |
| struct opendal_error * | opendal_operator_presign_write_with (const struct opendal_operator *op, const char *path, uint64_t expire_secs, const struct opendal_write_options *opts, struct opendal_presigned_request **req) |
| Presign a write operation with options. | |
| struct opendal_error * | opendal_operator_presign_write_with_cancel (const struct opendal_operator *op, const char *path, uint64_t expire_secs, const struct opendal_write_options *opts, const struct opendal_cancel_token *cancel, struct opendal_presigned_request **req) |
| Presign a write operation with options and optional cancellation. | |
| struct opendal_error * | opendal_operator_presign_delete (const struct opendal_operator *op, const char *path, uint64_t expire_secs, struct opendal_presigned_request **req) |
| Presign a delete operation. | |
| struct opendal_error * | opendal_operator_presign_delete_with (const struct opendal_operator *op, const char *path, uint64_t expire_secs, const struct opendal_delete_options *opts, struct opendal_presigned_request **req) |
| Presign a delete operation with options. | |
| struct opendal_error * | opendal_operator_presign_delete_with_cancel (const struct opendal_operator *op, const char *path, uint64_t expire_secs, const struct opendal_delete_options *opts, const struct opendal_cancel_token *cancel, struct opendal_presigned_request **req) |
| Presign a delete operation with options and optional cancellation. | |
| struct opendal_error * | opendal_operator_presign_stat (const struct opendal_operator *op, const char *path, uint64_t expire_secs, struct opendal_presigned_request **req) |
| Presign a stat operation. | |
| struct opendal_error * | opendal_operator_presign_stat_with (const struct opendal_operator *op, const char *path, uint64_t expire_secs, const struct opendal_stat_options *opts, struct opendal_presigned_request **req) |
| Presign a stat operation with options. | |
| struct opendal_error * | opendal_operator_presign_stat_with_cancel (const struct opendal_operator *op, const char *path, uint64_t expire_secs, const struct opendal_stat_options *opts, const struct opendal_cancel_token *cancel, struct opendal_presigned_request **req) |
| Presign a stat operation with options and optional cancellation. | |
| const char * | opendal_presigned_request_method (const struct opendal_presigned_request *req) |
| const char * | opendal_presigned_request_uri (const struct opendal_presigned_request *req) |
| const struct opendal_http_header_pair * | opendal_presigned_request_headers (const struct opendal_presigned_request *req) |
| uintptr_t | opendal_presigned_request_headers_len (const struct opendal_presigned_request *req) |
| void | opendal_presigned_request_free (struct opendal_presigned_request *req) |
| Free the presigned request. | |
| void | opendal_string_free (char *ptr) |
| Frees a heap-allocated string returned by OpenDAL C APIs. | |
| void | opendal_bytes_free (struct opendal_bytes *ptr) |
| Frees the heap memory used by the opendal_bytes. | |
| struct opendal_list_options * | opendal_list_options_new (void) |
| Construct a heap-allocated opendal_list_options with default values. | |
| void | opendal_list_options_set_recursive (struct opendal_list_options *opts, bool recursive) |
| Set recursive. | |
| void | opendal_list_options_set_limit (struct opendal_list_options *opts, uintptr_t limit) |
| Set limit. | |
| void | opendal_list_options_set_start_after (struct opendal_list_options *opts, const char *start_after) |
| Set start_after. | |
| void | opendal_list_options_set_versions (struct opendal_list_options *opts, bool versions) |
| Set versions. | |
| void | opendal_list_options_set_deleted (struct opendal_list_options *opts, bool deleted) |
| Set deleted. | |
| void | opendal_list_options_free (struct opendal_list_options *opts) |
| Free the heap memory used by opendal_list_options. | |
| struct opendal_stat_options * | opendal_stat_options_new (void) |
| Construct a heap-allocated opendal_stat_options with default values. | |
| void | opendal_stat_options_set_version (struct opendal_stat_options *opts, const char *version) |
| Set version. | |
| void | opendal_stat_options_set_if_match (struct opendal_stat_options *opts, const char *if_match) |
| Set if_match. | |
| void | opendal_stat_options_set_if_none_match (struct opendal_stat_options *opts, const char *if_none_match) |
| Set if_none_match. | |
| void | opendal_stat_options_set_if_modified_since (struct opendal_stat_options *opts, int64_t if_modified_since) |
| Set if_modified_since. | |
| void | opendal_stat_options_set_if_unmodified_since (struct opendal_stat_options *opts, int64_t if_unmodified_since) |
| Set if_unmodified_since. | |
| void | opendal_stat_options_set_override_content_type (struct opendal_stat_options *opts, const char *override_content_type) |
| Set override_content_type. | |
| void | opendal_stat_options_set_override_cache_control (struct opendal_stat_options *opts, const char *override_cache_control) |
| Set override_cache_control. | |
| void | opendal_stat_options_set_override_content_disposition (struct opendal_stat_options *opts, const char *override_content_disposition) |
| Set override_content_disposition. | |
| void | opendal_stat_options_free (struct opendal_stat_options *opts) |
| Free the heap memory used by opendal_stat_options. | |
| struct opendal_delete_options * | opendal_delete_options_new (void) |
| Construct a heap-allocated opendal_delete_options with default values. | |
| void | opendal_delete_options_set_version (struct opendal_delete_options *opts, const char *version) |
| Set version. | |
| void | opendal_delete_options_set_recursive (struct opendal_delete_options *opts, bool recursive) |
| Set recursive. | |
| void | opendal_delete_options_free (struct opendal_delete_options *opts) |
| Free the heap memory used by opendal_delete_options. | |
| struct opendal_read_options * | opendal_read_options_new (void) |
| Construct a heap-allocated opendal_read_options with default values. | |
| void | opendal_read_options_set_range (struct opendal_read_options *opts, uint64_t offset, uint64_t length) |
| Set the range to length bytes from offset. | |
| void | opendal_read_options_set_range_from (struct opendal_read_options *opts, uint64_t offset) |
| Set the range to start at offset and continue to the end of the file. | |
| void | opendal_read_options_set_version (struct opendal_read_options *opts, const char *version) |
| Set version. | |
| void | opendal_read_options_set_if_match (struct opendal_read_options *opts, const char *if_match) |
| Set if_match. | |
| void | opendal_read_options_set_if_none_match (struct opendal_read_options *opts, const char *if_none_match) |
| Set if_none_match. | |
| void | opendal_read_options_set_if_modified_since (struct opendal_read_options *opts, int64_t if_modified_since) |
| Set if_modified_since. | |
| void | opendal_read_options_set_if_unmodified_since (struct opendal_read_options *opts, int64_t if_unmodified_since) |
| Set if_unmodified_since. | |
| void | opendal_read_options_set_concurrent (struct opendal_read_options *opts, uintptr_t concurrent) |
| Set concurrent. | |
| void | opendal_read_options_set_chunk (struct opendal_read_options *opts, uintptr_t chunk) |
| Set chunk. | |
| void | opendal_read_options_set_gap (struct opendal_read_options *opts, uintptr_t gap) |
| Set gap. | |
| void | opendal_read_options_set_content_length_hint (struct opendal_read_options *opts, uint64_t content_length_hint) |
| Set content_length_hint. | |
| void | opendal_read_options_set_override_content_type (struct opendal_read_options *opts, const char *override_content_type) |
| Set override_content_type. | |
| void | opendal_read_options_set_override_cache_control (struct opendal_read_options *opts, const char *override_cache_control) |
| Set override_cache_control. | |
| void | opendal_read_options_set_override_content_disposition (struct opendal_read_options *opts, const char *override_content_disposition) |
| Set override_content_disposition. | |
| void | opendal_read_options_free (struct opendal_read_options *opts) |
| Free the heap memory used by opendal_read_options. | |
| struct opendal_reader_options * | opendal_reader_options_new (void) |
| Construct a heap-allocated opendal_reader_options with default values. | |
| void | opendal_reader_options_set_version (struct opendal_reader_options *opts, const char *version) |
| Set version. | |
| void | opendal_reader_options_set_if_match (struct opendal_reader_options *opts, const char *if_match) |
| Set if_match. | |
| void | opendal_reader_options_set_if_none_match (struct opendal_reader_options *opts, const char *if_none_match) |
| Set if_none_match. | |
| void | opendal_reader_options_set_if_modified_since (struct opendal_reader_options *opts, int64_t if_modified_since) |
| Set if_modified_since. | |
| void | opendal_reader_options_set_if_unmodified_since (struct opendal_reader_options *opts, int64_t if_unmodified_since) |
| Set if_unmodified_since. | |
| void | opendal_reader_options_set_content_length_hint (struct opendal_reader_options *opts, uint64_t content_length_hint) |
| Set content_length_hint. | |
| void | opendal_reader_options_set_concurrent (struct opendal_reader_options *opts, uintptr_t concurrent) |
| Set concurrent. | |
| void | opendal_reader_options_set_chunk (struct opendal_reader_options *opts, uintptr_t chunk) |
| Set chunk. | |
| void | opendal_reader_options_set_gap (struct opendal_reader_options *opts, uintptr_t gap) |
| Set gap. | |
| void | opendal_reader_options_set_prefetch (struct opendal_reader_options *opts, uintptr_t prefetch) |
| Set prefetch. | |
| void | opendal_reader_options_free (struct opendal_reader_options *opts) |
| Free the heap memory used by opendal_reader_options. | |
| struct opendal_write_options * | opendal_write_options_new (void) |
| Construct a heap-allocated opendal_write_options with default values. | |
| void | opendal_write_options_set_append (struct opendal_write_options *opts, bool append) |
| Set append. | |
| void | opendal_write_options_set_cache_control (struct opendal_write_options *opts, const char *cache_control) |
| Set cache_control. | |
| void | opendal_write_options_set_content_type (struct opendal_write_options *opts, const char *content_type) |
| Set content_type. | |
| void | opendal_write_options_set_content_disposition (struct opendal_write_options *opts, const char *content_disposition) |
| Set content_disposition. | |
| void | opendal_write_options_set_content_encoding (struct opendal_write_options *opts, const char *content_encoding) |
| Set content_encoding. | |
| void | opendal_write_options_set_if_match (struct opendal_write_options *opts, const char *if_match) |
| Set if_match. | |
| void | opendal_write_options_set_if_none_match (struct opendal_write_options *opts, const char *if_none_match) |
| Set if_none_match. | |
| void | opendal_write_options_set_if_not_exists (struct opendal_write_options *opts, bool if_not_exists) |
| Set if_not_exists. | |
| void | opendal_write_options_set_concurrent (struct opendal_write_options *opts, uintptr_t concurrent) |
| Set concurrent. | |
| void | opendal_write_options_set_chunk (struct opendal_write_options *opts, uintptr_t chunk) |
| Set chunk. | |
| void | opendal_write_options_set_user_metadata (struct opendal_write_options *opts, const struct opendal_write_user_metadata_pair *pairs, uintptr_t len) |
| Set user_metadata. | |
| void | opendal_write_options_free (struct opendal_write_options *opts) |
| Free the heap memory used by opendal_write_options. | |
| struct opendal_copy_options * | opendal_copy_options_new (void) |
| Construct a heap-allocated opendal_copy_options with default values. | |
| void | opendal_copy_options_set_if_not_exists (struct opendal_copy_options *opts, bool if_not_exists) |
| Set if_not_exists. | |
| void | opendal_copy_options_set_if_match (struct opendal_copy_options *opts, const char *if_match) |
| Set if_match. | |
| void | opendal_copy_options_set_source_version (struct opendal_copy_options *opts, const char *source_version) |
| Set source_version. | |
| void | opendal_copy_options_set_source_content_length_hint (struct opendal_copy_options *opts, uint64_t source_content_length_hint) |
| Set source_content_length_hint. | |
| void | opendal_copy_options_set_concurrent (struct opendal_copy_options *opts, uintptr_t concurrent) |
| Set concurrent. | |
| void | opendal_copy_options_set_chunk (struct opendal_copy_options *opts, uintptr_t chunk) |
| Set chunk. | |
| void | opendal_copy_options_free (struct opendal_copy_options *opts) |
| Free the heap memory used by opendal_copy_options. | |
| struct opendal_operator_options * | opendal_operator_options_new (void) |
| Construct a heap-allocated opendal_operator_options. | |
| void | opendal_operator_options_set (struct opendal_operator_options *opts, const char *key, const char *value) |
| Set a Key-Value pair inside opendal_operator_options. | |
| void | opendal_operator_options_free (struct opendal_operator_options *ptr) |
| Free the allocated memory used by [opendal_operator_options]. | |
| char * | opendal_entry_path (const struct opendal_entry *self) |
| Path of entry. | |
| char * | opendal_entry_name (const struct opendal_entry *self) |
| Name of entry. | |
| struct opendal_metadata * | opendal_entry_metadata (const struct opendal_entry *self) |
| Return the metadata associated with this entry. | |
| void | opendal_entry_free (struct opendal_entry *ptr) |
| Frees the heap memory used by the opendal_list_entry. | |
| struct opendal_error * | opendal_reader_read (struct opendal_reader *self, uint8_t *buf, uintptr_t len, uintptr_t *size) |
| Read data from the reader into buf and write the number of bytes read to *size. | |
| struct opendal_error * | opendal_reader_read_with_cancel (struct opendal_reader *self, uint8_t *buf, uintptr_t len, const struct opendal_cancel_token *cancel, uintptr_t *size) |
| Read data from the reader into buf, supporting cancellation via cancel. | |
| struct opendal_error * | opendal_reader_seek (struct opendal_reader *self, int64_t offset, int32_t whence, uint64_t *pos) |
| Seek to an offset, in bytes, in a stream, and write the new position to *pos. | |
| struct opendal_error * | opendal_reader_seek_with_cancel (struct opendal_reader *self, int64_t offset, int32_t whence, const struct opendal_cancel_token *cancel, uint64_t *pos) |
| Seek to an offset, in bytes, in a stream, supporting cancellation via cancel. | |
| void | opendal_reader_free (struct opendal_reader *ptr) |
| Frees the heap memory used by the opendal_reader. | |
| struct opendal_error * | opendal_writer_write (struct opendal_writer *self, const struct opendal_bytes *bytes, uintptr_t *size) |
| Write data to the writer and write the number of bytes written to *size. | |
| struct opendal_error * | opendal_writer_write_with_cancel (struct opendal_writer *self, const struct opendal_bytes *bytes, const struct opendal_cancel_token *cancel, uintptr_t *size) |
| Write data to the writer, supporting cancellation via cancel. | |
| struct opendal_error * | opendal_writer_close (struct opendal_writer *ptr) |
| Close the writer and make sure all data have been stored. | |
| struct opendal_error * | opendal_writer_close_with_metadata (struct opendal_writer *ptr, struct opendal_metadata **meta) |
| Close the writer and write the written object's metadata to *meta. | |
| struct opendal_error * | opendal_writer_close_with_cancel (struct opendal_writer *ptr, const struct opendal_cancel_token *cancel, struct opendal_metadata **meta) |
| Close the writer, supporting cancellation via cancel and optional metadata output. | |
| void | opendal_writer_free (struct opendal_writer *ptr) |
| Frees the heap memory used by the opendal_writer. | |
| struct opendal_error * | opendal_copier_next (struct opendal_copier *self, uintptr_t *size, bool *has_next) |
| Perform one step of the copy operation. | |
| struct opendal_error * | opendal_copier_next_with_cancel (struct opendal_copier *self, const struct opendal_cancel_token *cancel, uintptr_t *size, bool *has_next) |
| Perform one step of the copy operation, supporting cancellation via cancel. | |
| struct opendal_error * | opendal_copier_abort (struct opendal_copier *self) |
| Abort the pending copy operation. | |
| struct opendal_error * | opendal_copier_abort_with_cancel (struct opendal_copier *self, const struct opendal_cancel_token *cancel) |
| Abort the pending copy operation, supporting cancellation via cancel. | |
| void | opendal_copier_free (struct opendal_copier *ptr) |
| Free the heap memory used by the opendal_copier. | |
| struct opendal_error * | opendal_deleter_delete (struct opendal_deleter *self, const char *path) |
| Submit path for deletion. | |
| struct opendal_error * | opendal_deleter_delete_many (struct opendal_deleter *self, const char *const *paths, uintptr_t paths_len) |
| Submit multiple paths for deletion in one call. | |
| struct opendal_error * | opendal_deleter_delete_many_with_cancel (struct opendal_deleter *self, const char *const *paths, uintptr_t paths_len, const struct opendal_cancel_token *cancel) |
| Submit multiple paths for deletion in one call, supporting cancellation via cancel. | |
| struct opendal_error * | opendal_deleter_delete_with (struct opendal_deleter *self, const char *path, const struct opendal_delete_options *opts) |
| Submit path for deletion with per-path options. | |
| struct opendal_error * | opendal_deleter_delete_with_cancel (struct opendal_deleter *self, const char *path, const struct opendal_delete_options *opts, const struct opendal_cancel_token *cancel) |
| Submit path for deletion with per-path options, supporting cancellation via cancel. | |
| struct opendal_error * | opendal_deleter_flush (struct opendal_deleter *self) |
| Complete pending deletions and keep the deleter usable. | |
| struct opendal_error * | opendal_deleter_flush_with_cancel (struct opendal_deleter *self, const struct opendal_cancel_token *cancel) |
| Complete pending deletions and keep the deleter usable, supporting cancellation via cancel. | |
| void | opendal_deleter_free (struct opendal_deleter *ptr) |
| Free the heap memory used by the opendal_deleter. | |
| #define OPENDAL_SEEK_CUR 1 |
Seek relative to the current stream position.
| #define OPENDAL_SEEK_END 2 |
Seek relative to the end of the stream.
| #define OPENDAL_SEEK_SET 0 |
Seek from the start of the stream.
| typedef struct opendal_bytes opendal_bytes |
opendal_bytes carries raw-bytes with its length
The opendal_bytes type is a C-compatible substitute for Vec type in Rust. For buffers returned by OpenDAL C APIs, call opendal_bytes_free() to free the heap memory and avoid memory leaks. If you reuse an opendal_bytes output variable across multiple read calls, call opendal_bytes_free() on the previous result before passing it again as an output parameter. For caller-owned input buffers passed to OpenDAL C APIs, the caller keeps ownership and must not call opendal_bytes_free() on them.
| typedef struct opendal_cancel_token opendal_cancel_token |
An opaque, thread-safe token used to cancel in-flight OpenDAL operations.
Pass a token created with opendal_cancel_token_new() to any *_with_cancel function. Calling opendal_cancel_token_cancel() from another thread wakes waiting operations and causes them to drop their in-flight work and return OPENDAL_CANCELLED.
A single token may be shared across multiple concurrent operations, and cancelling it is idempotent. Free the token with opendal_cancel_token_free() only after all operations using it have returned.
| typedef struct opendal_capability opendal_capability |
Capability is used to describe what operations are supported by current Operator.
Size limit fields are zero when the operator does not define a limit.
These flags describe the underlying OpenDAL operator. A flag can be true even when the C binding does not expose the matching function (for example, restore).
| typedef enum opendal_code opendal_code |
The error code for all opendal APIs in C binding.
| typedef struct opendal_copier opendal_copier |
opendal_copier completes a long-running copy operation to completion in a blocking manner. opendal_copier repeatedly calls a copy operation until completion.
Internally, each copy step performs a unit of work and reports progress. When copy completes, has_next returns false.
A "step" is one backend-defined unit of work. For backends that copy in multiple requests (e.g. multipart copy), one step typically copies one chunk; for backends that only support single-request copy, the entire copy happens in a single step. The reported byte count is best-effort: a step may report 0 bytes when the backend advances its state without a reliable byte delta.
Users can construct a copier by opendal_operator_copier, opendal_operator_copier_with, or opendal_operator_copier_with_cancel.
| typedef struct opendal_copy_options opendal_copy_options |
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.
| typedef struct opendal_delete_options opendal_delete_options |
Options for delete operations.
C exposes only version and recursive, and neither is a condition, so the conditions below cannot be used from C yet. Selecting a version with version fails with OPENDAL_UNSUPPORTED when opendal_capability.delete_with_version is false, even if the path is missing.
Each condition checks the file currently stored at the delete path, and every condition must hold for the delete to proceed:
With valid, supported options, deleting a missing file remains a successful no-op once every condition holds.
See the conditional operation specification for the complete cross-operation contract.
Use opendal_delete_options_new() to construct and opendal_delete_options_free() to free.
A caller that declares the struct itself must initialize every member, for example with opendal_delete_options opts = {0};, because a function that takes these options reads every member.
| typedef struct opendal_deleter opendal_deleter |
opendal_deleter removes many paths from storage.
Uses batch deletion when the service supports it. Submitting paths can delete them immediately or trigger a batch. Call opendal_deleter_flush to wait for any pending deletions to complete.
The handle stays usable after a flush. On a batch flush failure, pending paths remain queued for another flush.
Construct a deleter with opendal_operator_deleter and release it with opendal_deleter_free. Calls using the same handle must not overlap.
| typedef struct opendal_entry opendal_entry |
opendal_list_entry is the entry under a path, which is listed from the opendal_lister
For examples, please see the comment section of opendal_operator_list()
| typedef struct opendal_error opendal_error |
The opendal error type for C binding, containing an error code and corresponding error message.
The normal operations returns a pointer to the opendal_error, and the nullptr normally represents no error has taken placed. If any error has taken place, the caller should check the error code and print the error message.
The error code is represented in opendal_code, which is an enum on different type of errors. The error messages is represented in opendal_bytes, which is a non-null terminated byte array.
| typedef struct opendal_http_header_pair opendal_http_header_pair |
The key-value pair for the headers of the presigned request.
| typedef struct opendal_list_options opendal_list_options |
Options for list operations.
The operation fails with OPENDAL_UNSUPPORTED when an option requires a capability that the operator lacks.
Use opendal_list_options_new() to construct and opendal_list_options_free() to free.
A caller that declares the struct itself must initialize every member, for example with opendal_list_options opts = {0};, because a function that takes these options reads every member.
| typedef struct opendal_lister opendal_lister |
Lister is designed to list entries at a given path in a blocking manner.
Users can construct a lister with opendal_operator_list, opendal_operator_list_with, or opendal_operator_list_with_cancel.
For examples, please see the comment section of opendal_operator_list()
| typedef void(* opendal_log_callback) (int32_t level, const char *file, uint32_t line, const char *message) |
A native logging callback. Levels are DEBUG=0 (including TRACE), INFO=1, WARN=2, and ERROR=3; these values are not glog severity values.
File and message are non-null, NUL-terminated strings borrowed only for the callback invocation. Copy any value retained after the callback returns. Embedded NUL bytes are rendered as \0. An unavailable file is empty and an unavailable line is zero.
The callback must remain valid for the lifetime of the program, support concurrent calls, and not unwind through the C ABI. Recursive logging from the callback is not supported.
| typedef struct opendal_metadata opendal_metadata |
Carries all metadata associated with a path.
The metadata of the "thing" under a path. Please only use the opendal_metadata with our provided API, e.g. opendal_metadata_content_length().
| typedef struct opendal_metadata_user_metadata opendal_metadata_user_metadata |
User metadata associated with a path.
| typedef struct opendal_metadata_user_metadata_pair opendal_metadata_user_metadata_pair |
A user metadata key-value pair.
| typedef struct opendal_operator opendal_operator |
Used to access almost all OpenDAL APIs. It represents an operator that provides the unified interfaces provided by OpenDAL.
| typedef struct opendal_operator_info opendal_operator_info |
Metadata for operator, users can use this metadata to get information of operator.
| typedef struct opendal_operator_layers opendal_operator_layers |
The layers to apply when initializing an opendal_operator.
| typedef struct opendal_operator_options opendal_operator_options |
The configuration for the initialization of opendal_operator.
| typedef struct opendal_presigned_request opendal_presigned_request |
The underlying presigned request, which contains the HTTP method, URI, and headers. This is an opaque struct, please use the accessor functions to get the fields.
| typedef struct opendal_presigned_request_inner opendal_presigned_request_inner |
| typedef struct opendal_read_options opendal_read_options |
Options for read operations.
Each condition checks the file being read, and every condition must hold for the read to proceed. Once the option and capability checks pass, a read that reaches storage fails with OPENDAL_NOT_FOUND for a missing file, no matter which conditions are set. An existing file that fails a condition returns OPENDAL_CONDITION_NOT_MATCH, and a condition the service does not advertise through its capability returns OPENDAL_UNSUPPORTED; OpenDAL never silently drops a condition. A read with an empty range, such as one that opendal_read_options_set_range(opts, offset, 0) sets, validates the read options and capabilities, then returns an empty buffer without accessing storage or evaluating conditions against the file.
See the conditional operation specification for the complete cross-operation contract.
Use opendal_read_options_new() to construct and opendal_read_options_free() to free.
A caller that declares the struct itself must initialize every member, for example with opendal_read_options opts = {0};, because a function that takes these options reads every member, also one whose has_* member is false.
| typedef struct opendal_reader opendal_reader |
The result type returned by opendal's reader operation.
| typedef struct opendal_reader_options opendal_reader_options |
Options for reader operations.
Each condition checks the file being read, and every condition must hold for the reader to produce data. Once the option and capability checks pass, a read that reaches storage fails with OPENDAL_NOT_FOUND for a missing file, no matter which conditions are set. An existing file that fails a condition returns OPENDAL_CONDITION_NOT_MATCH, and a condition the service does not advertise through its capability returns OPENDAL_UNSUPPORTED; OpenDAL never silently drops a condition. Without a positive chunk, or with content_length_hint set, opendal_operator_reader_with() checks the options and capabilities without accessing storage, so a missing file or a failed condition surfaces when a read from the returned reader reaches storage. With a positive chunk and no content_length_hint, it first stats the file, so either can fail opendal_operator_reader_with() instead. opendal_reader_seek() with OPENDAL_SEEK_END also stats the file unless the reader knows the file's length, from content_length_hint, the stat for chunk, an earlier successful OPENDAL_SEEK_END seek, or an earlier read on a service that reports it. Each such stat carries the reader's version and conditions, as chunk describes.
See the conditional operation specification for the complete cross-operation contract.
Use opendal_reader_options_new() to construct and opendal_reader_options_free() to free.
A caller that declares the struct itself must initialize every member, for example with opendal_reader_options opts = {0};, because a function that takes these options reads every member, also one whose has_* member is false.
| typedef struct opendal_stat_options opendal_stat_options |
Options for stat operations.
Each condition checks the file being observed, and every condition must hold for the stat to return metadata. With valid, supported options, stat returns OPENDAL_NOT_FOUND for a missing file. An existing file that fails a condition returns OPENDAL_CONDITION_NOT_MATCH, and a condition the service does not advertise through its capability returns OPENDAL_UNSUPPORTED; OpenDAL never silently drops a condition.
See the conditional operation specification for the complete cross-operation contract.
Use opendal_stat_options_new() to construct and opendal_stat_options_free() to free.
A caller that declares the struct itself must initialize every member, for example with opendal_stat_options opts = {0};, because a function that takes these options reads every member, also one whose has_* member is false.
| typedef struct opendal_write_options opendal_write_options |
Options for write operations.
Each condition checks the file currently stored at the write path, and the service evaluates it atomically with the write's visible commit:
See the conditional operation specification for the complete cross-operation contract.
Use opendal_write_options_new() to construct and opendal_write_options_free() to free.
A caller that declares the struct itself must initialize every member, for example with opendal_write_options opts = {0};, because a function that takes these options reads every member, also one whose has_* member is false.
| typedef struct opendal_write_user_metadata_pair opendal_write_user_metadata_pair |
A key-value pair for write user metadata.
opendal_write_options.user_metadata points to an array of these pairs, and the operation reads the first user_metadata_len of them. A pair whose key or value is NULL is skipped.
| typedef struct opendal_writer opendal_writer |
The result type returned by opendal's writer operation.
| enum opendal_code |
The error code for all opendal APIs in C binding.
| Enumerator | |
|---|---|
| OPENDAL_UNEXPECTED | returning it back. For example, s3 returns an internal service error. |
| OPENDAL_UNSUPPORTED | Underlying service doesn't support this operation. |
| OPENDAL_CONFIG_INVALID | The config for backend is invalid. |
| OPENDAL_NOT_FOUND | The given path is not found. |
| OPENDAL_PERMISSION_DENIED | The given path doesn't have enough permission for this operation |
| OPENDAL_IS_A_DIRECTORY | The given path is a directory. |
| OPENDAL_NOT_A_DIRECTORY | The given path is not a directory. |
| OPENDAL_ALREADY_EXISTS | The given path already exists thus we failed to the specified operation on it. |
| OPENDAL_RATE_LIMITED | Requests that sent to this path is over the limit, please slow down. |
| OPENDAL_IS_SAME_FILE | The given file paths are same. |
| OPENDAL_CONDITION_NOT_MATCH | A condition supplied through the OpenDAL operation evaluated to false. |
| OPENDAL_RANGE_NOT_SATISFIED | The range of the content is not satisfied. |
| OPENDAL_CONFLICT | The operation conflicts with the current or transitional state of the resource. |
| OPENDAL_CANCELLED | The operation was cancelled via an opendal_cancel_token. |
| OPENDAL_CHECKSUM_MISMATCH | A checksum did not match the expected value. |
| void opendal_bytes_free | ( | struct opendal_bytes * | ptr | ) |
Frees the heap memory used by the opendal_bytes.
| uint32_t opendal_c_abi_version | ( | void | ) |
Returns the C ABI version. This value changes on incompatible changes to the C ABI, including changes to exported struct layouts.
| uintptr_t opendal_c_capability_size | ( | void | ) |
Returns the size in bytes of the library's opendal_capability struct.
| const char * opendal_c_version | ( | void | ) |
Returns the compiled OpenDAL core version as a NUL-terminated string.
The library owns the read-only string. It remains valid while the library is loaded.
| void opendal_cancel_token_cancel | ( | const struct opendal_cancel_token * | token | ) |
Signal cancellation on token.
Safe to call from any thread while operations are in flight, safe to call multiple times, and a no-op when token is NULL.
| void opendal_cancel_token_free | ( | struct opendal_cancel_token * | token | ) |
Free the heap memory used by opendal_cancel_token.
Safe to call on NULL. Must only be called after every operation that received token has returned.
| bool opendal_cancel_token_is_cancelled | ( | const struct opendal_cancel_token * | token | ) |
Return whether token has been cancelled.
Returns false when token is NULL.
| struct opendal_cancel_token * opendal_cancel_token_new | ( | void | ) |
Allocate a new uncancelled opendal_cancel_token.
Free the returned token with opendal_cancel_token_free() once no operations are using it.
| struct opendal_error * opendal_copier_abort | ( | struct opendal_copier * | self | ) |
Abort the pending copy operation.
Returns NULL if the abort succeeds, otherwise it contains the error code and error message.
| struct opendal_error * opendal_copier_abort_with_cancel | ( | struct opendal_copier * | self, |
| const struct opendal_cancel_token * | cancel ) |
Abort the pending copy operation, supporting cancellation via cancel.
Pass NULL for cancel to run without cancellation. If cancelled mid-flight, returns OPENDAL_CANCELLED and preserves the copier so the caller can retry the abort with a fresh cancel token (or NULL) or free it cleanly.
| void opendal_copier_free | ( | struct opendal_copier * | ptr | ) |
Free the heap memory used by the opendal_copier.
| struct opendal_error * opendal_copier_next | ( | struct opendal_copier * | self, |
| uintptr_t * | size, | ||
| bool * | has_next ) |
Perform one step of the copy operation.
One step performs one backend-defined unit of work: typically one chunk for backends that copy in multiple requests, or the entire copy for backends that only support single-request copy.
Writes the number of bytes copied in this step to *size (best-effort; may be 0 when the backend advances without a reliable byte delta) and whether more steps remain to *has_next. When *has_next is true the caller should call this function again to continue the copy. When *has_next is false and the returned error is NULL the copy has completed. On failure, writes 0 to *size and false to *has_next, and returns an opendal_error *.
| struct opendal_error * opendal_copier_next_with_cancel | ( | struct opendal_copier * | self, |
| const struct opendal_cancel_token * | cancel, | ||
| uintptr_t * | size, | ||
| bool * | has_next ) |
Perform one step of the copy operation, supporting cancellation via cancel.
Pass NULL for cancel to run without cancellation. On cancellation, writes 0 to *size and false to *has_next, returns OPENDAL_CANCELLED, and preserves the copier so the caller can resume, abort, or free it cleanly.
| void opendal_copy_options_free | ( | struct opendal_copy_options * | opts | ) |
Free the heap memory used by opendal_copy_options.
| opts | The opendal_copy_options to free. |
| struct opendal_copy_options * opendal_copy_options_new | ( | void | ) |
Construct a heap-allocated opendal_copy_options with default values.
| void opendal_copy_options_set_chunk | ( | struct opendal_copy_options * | opts, |
| uintptr_t | chunk ) |
Set 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.
The setter also sets has_chunk.
| opts | The opendal_copy_options to modify. |
| chunk | The value to set. |
| void opendal_copy_options_set_concurrent | ( | struct opendal_copy_options * | opts, |
| uintptr_t | concurrent ) |
Set 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.
| opts | The opendal_copy_options to modify. |
| concurrent | The value to set; 0 is the default. |
| void opendal_copy_options_set_if_match | ( | struct opendal_copy_options * | opts, |
| const char * | if_match ) |
Set 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.
A non-NULL if_match must point to a readable, nul-terminated UTF-8 string. The setter stores it without copying it, so the string must stay valid until a function that takes opts, such as opendal_operator_copy_with(), returns.
| opts | The opendal_copy_options to modify. |
| if_match | The string to borrow; NULL unsets it. |
| void opendal_copy_options_set_if_not_exists | ( | struct opendal_copy_options * | opts, |
| bool | if_not_exists ) |
Set 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.
| opts | The opendal_copy_options to modify. |
| if_not_exists | The value to set. |
| void opendal_copy_options_set_source_content_length_hint | ( | struct opendal_copy_options * | opts, |
| uint64_t | source_content_length_hint ) |
Set 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.
The setter also sets has_source_content_length_hint.
| opts | The opendal_copy_options to modify. |
| source_content_length_hint | The value to set. |
| void opendal_copy_options_set_source_version | ( | struct opendal_copy_options * | opts, |
| const char * | source_version ) |
Set 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.
A non-NULL source_version must point to a readable, nul-terminated UTF-8 string. The setter stores it without copying it, so the string must stay valid until a function that takes opts, such as opendal_operator_copy_with(), returns.
| opts | The opendal_copy_options to modify. |
| source_version | The string to borrow; NULL unsets it. |
| void opendal_delete_options_free | ( | struct opendal_delete_options * | opts | ) |
Free the heap memory used by opendal_delete_options.
| opts | The opendal_delete_options to free. |
| struct opendal_delete_options * opendal_delete_options_new | ( | void | ) |
Construct a heap-allocated opendal_delete_options with default values.
| void opendal_delete_options_set_recursive | ( | struct opendal_delete_options * | opts, |
| bool | recursive ) |
Set recursive.
Whether to delete the target recursively.
The default, false, deletes a single object. With true, a trailing slash (for example, "a/") scopes deletion to a directory and its descendants across services. Prefix matching for paths without a trailing slash is service-specific. On prefix-based services such as memory, "a" also matches entries under "ab/".
With true, the operation returns OPENDAL_UNSUPPORTED when the service does not advertise opendal_capability.delete_with_recursive.
| opts | The opendal_delete_options to modify. |
| recursive | The value to set. |
| void opendal_delete_options_set_version | ( | struct opendal_delete_options * | opts, |
| const char * | version ) |
Set version.
Delete the given version of the file instead of the current one.
This selects which stored version the delete removes; it is not a condition on the file.
Check opendal_capability.delete_with_version before using this option.
| opts | The opendal_delete_options to modify. |
| version | The string to copy; NULL unsets it. |
| struct opendal_error * opendal_deleter_delete | ( | struct opendal_deleter * | self, |
| const char * | path ) |
Submit path for deletion.
Call opendal_deleter_flush to complete any pending deletions.
| path | The path to delete |
| struct opendal_error * opendal_deleter_delete_many | ( | struct opendal_deleter * | self, |
| const char *const * | paths, | ||
| uintptr_t | paths_len ) |
Submit multiple paths for deletion in one call.
All paths use default options. Use opendal_deleter_delete_with for per-path options. Submission stops at the first error. Earlier paths may already have been deleted. Call opendal_deleter_flush to complete any pending deletions.
| paths | The paths to delete |
| paths_len | The number of paths in paths |
| struct opendal_error * opendal_deleter_delete_many_with_cancel | ( | struct opendal_deleter * | self, |
| const char *const * | paths, | ||
| uintptr_t | paths_len, | ||
| const struct opendal_cancel_token * | cancel ) |
Submit multiple paths for deletion in one call, supporting cancellation via cancel.
Pass NULL for cancel to run without cancellation.
| paths | The paths to delete |
| paths_len | The number of paths in paths |
| cancel | Optional cancel token, or NULL |
| struct opendal_error * opendal_deleter_delete_with | ( | struct opendal_deleter * | self, |
| const char * | path, | ||
| const struct opendal_delete_options * | opts ) |
Submit path for deletion with per-path options.
| path | The path to delete |
| opts | The options for this path, or NULL to use defaults |
| struct opendal_error * opendal_deleter_delete_with_cancel | ( | struct opendal_deleter * | self, |
| const char * | path, | ||
| const struct opendal_delete_options * | opts, | ||
| const struct opendal_cancel_token * | cancel ) |
Submit path for deletion with per-path options, supporting cancellation via cancel.
Pass NULL for opts to use defaults, and NULL for cancel to run without cancellation.
| path | The path to delete |
| opts | The options for this path, or NULL to use defaults |
| cancel | Optional cancel token, or NULL |
| struct opendal_error * opendal_deleter_flush | ( | struct opendal_deleter * | self | ) |
Complete pending deletions and keep the deleter usable.
Call this before freeing the handle to complete the deletions. If a batch flush fails, pending paths remain queued for a retry.
| struct opendal_error * opendal_deleter_flush_with_cancel | ( | struct opendal_deleter * | self, |
| const struct opendal_cancel_token * | cancel ) |
Complete pending deletions and keep the deleter usable, supporting cancellation via cancel.
Pass NULL for cancel to run without cancellation.
| cancel | Optional cancel token, or NULL |
| void opendal_deleter_free | ( | struct opendal_deleter * | ptr | ) |
Free the heap memory used by the opendal_deleter.
Freeing a deleter drops the queued paths that were never flushed: call opendal_deleter_flush first unless you mean to discard them.
| void opendal_entry_free | ( | struct opendal_entry * | ptr | ) |
Frees the heap memory used by the opendal_list_entry.
| struct opendal_metadata * opendal_entry_metadata | ( | const struct opendal_entry * | self | ) |
Return the metadata associated with this entry.
The returned metadata is heap-allocated and must be freed by the caller via opendal_metadata_free().
| char * opendal_entry_name | ( | const struct opendal_entry * | self | ) |
Name of entry.
Name is the last segment of path. If this entry is a dir, Name MUST endswith / Otherwise, Name MUST NOT endswith /.
| char * opendal_entry_path | ( | const struct opendal_entry * | self | ) |
Path of entry.
Path is relative to operator's root. Only valid in current operator.
| void opendal_error_free | ( | struct opendal_error * | ptr | ) |
Frees the opendal_error, ok to call on NULL.
| void opendal_list_options_free | ( | struct opendal_list_options * | opts | ) |
Free the heap memory used by opendal_list_options.
| opts | The opendal_list_options to free. |
| struct opendal_list_options * opendal_list_options_new | ( | void | ) |
Construct a heap-allocated opendal_list_options with default values.
| void opendal_list_options_set_deleted | ( | struct opendal_list_options * | opts, |
| bool | deleted ) |
Set deleted.
Include delete markers; default false.
Requires opendal_capability.list_with_deleted.
| opts | The opendal_list_options to modify. |
| deleted | The value to set. |
| void opendal_list_options_set_limit | ( | struct opendal_list_options * | opts, |
| uintptr_t | limit ) |
Set limit.
Maximum results per request (backend hint) to control memory and throttling.
| opts | The opendal_list_options to modify. |
| limit | The value to set; 0 unsets it. |
| void opendal_list_options_set_recursive | ( | struct opendal_list_options * | opts, |
| bool | recursive ) |
Set recursive.
Whether to list recursively under the prefix; default false.
Setting this option to true requires the operator's effective opendal_capability.list_with_recursive capability.
| opts | The opendal_list_options to modify. |
| recursive | The value to set. |
| void opendal_list_options_set_start_after | ( | struct opendal_list_options * | opts, |
| const char * | start_after ) |
Set start_after.
Start listing after this key, excluding the key itself.
Setting this requires opendal_capability.list_with_start_after.
| opts | The opendal_list_options to modify. |
| start_after | The string to copy; NULL unsets it. |
| void opendal_list_options_set_versions | ( | struct opendal_list_options * | opts, |
| bool | versions ) |
Set versions.
Include object versions; default false.
Requires opendal_capability.list_with_versions.
| opts | The opendal_list_options to modify. |
| versions | The value to set. |
| void opendal_lister_free | ( | struct opendal_lister * | ptr | ) |
Free the heap-allocated metadata used by opendal_lister.
| struct opendal_error * opendal_lister_next | ( | struct opendal_lister * | self, |
| struct opendal_entry ** | entry ) |
Return the next object to be listed.
Lister is an iterator of the objects under its path, this method is the same as calling next() on the iterator.
On success, writes the next entry pointer (or NULL when listing is exhausted) to *entry and returns NULL. On failure, writes NULL to *entry and returns a newly allocated error that must be freed with opendal_error_free().
For examples, please see the comment section of opendal_operator_list()
| struct opendal_error * opendal_lister_next_with_cancel | ( | struct opendal_lister * | self, |
| const struct opendal_cancel_token * | cancel, | ||
| struct opendal_entry ** | entry ) |
Return the next object to be listed, supporting cancellation via cancel.
Pass NULL for cancel to run without cancellation. On success, writes the next entry pointer (or NULL when listing is exhausted) to *entry and returns NULL. On cancellation or failure, writes NULL to *entry and returns an opendal_error * (OPENDAL_CANCELLED on cancellation).
| struct opendal_error * opendal_logging_init | ( | opendal_log_callback | callback | ) |
Installs one process-global native callback for the library's Rust log facade.
The default C operator constructor adds a logging layer that emits operation events through this callback. With opendal_operator_new_with_layers, set layers=logging in the options to enable operation logging. The callback can also receive records from other Rust components using the same log facade.
Returns NULL on success. A null callback or an already installed logger returns OPENDAL_CONFIG_INVALID; free that error with opendal_error_free. A registration failure leaves the installed logger and its level unchanged. This function cannot replace or unregister a logger.
A non-null callback must satisfy the lifetime and concurrency requirements documented on opendal_log_callback.
| char * opendal_metadata_cache_control | ( | const struct opendal_metadata * | self | ) |
Return this entry's Cache-Control value.
| char * opendal_metadata_content_disposition | ( | const struct opendal_metadata * | self | ) |
Return this entry's Content-Disposition value.
| char * opendal_metadata_content_encoding | ( | const struct opendal_metadata * | self | ) |
Return this entry's Content-Encoding value.
| char * opendal_metadata_content_language | ( | const struct opendal_metadata * | self | ) |
Return this entry's Content-Language value, if available.
| uint64_t opendal_metadata_content_length | ( | const struct opendal_metadata * | self | ) |
Return the full content length of this entry.
| char * opendal_metadata_content_md5 | ( | const struct opendal_metadata * | self | ) |
Return this entry's Content-MD5 value.
| char * opendal_metadata_content_type | ( | const struct opendal_metadata * | self | ) |
Return this entry's Content-Type value.
| char * opendal_metadata_etag | ( | const struct opendal_metadata * | self | ) |
Return this entry's service-provided ETag as-is.
| void opendal_metadata_free | ( | struct opendal_metadata * | ptr | ) |
Free the heap-allocated metadata used by opendal_metadata.
| struct opendal_metadata_user_metadata * opendal_metadata_get_user_metadata | ( | const struct opendal_metadata * | self | ) |
Return the user metadata of the metadata.
| uint8_t opendal_metadata_is_current | ( | const struct opendal_metadata * | self | ) |
Return whether this metadata describes the current object version.
Returns 1 for true, 0 for false, and 2 if unknown.
| bool opendal_metadata_is_deleted | ( | const struct opendal_metadata * | self | ) |
Return whether this metadata describes a deleted object or delete marker.
| bool opendal_metadata_is_dir | ( | const struct opendal_metadata * | self | ) |
Return whether the path represents a directory.
| bool opendal_metadata_is_file | ( | const struct opendal_metadata * | self | ) |
Return whether the path represents a file.
| int64_t opendal_metadata_last_modified_ms | ( | const struct opendal_metadata * | self | ) |
Return this entry's Last-Modified timestamp.
Returns milliseconds since the Unix epoch, or -1 if unknown.
| uint8_t opendal_metadata_mode | ( | const struct opendal_metadata * | self | ) |
Return this entry's mode.
Returns 0 for unknown, 1 for file, and 2 for dir.
| void opendal_metadata_user_metadata_free | ( | struct opendal_metadata_user_metadata * | metadata | ) |
Free the user metadata returned by opendal_metadata_user_metadata.
| uintptr_t opendal_metadata_user_metadata_len | ( | const struct opendal_metadata_user_metadata * | metadata | ) |
Return the number of key-value pairs in the user metadata.
| const struct opendal_metadata_user_metadata_pair * opendal_metadata_user_metadata_pairs | ( | const struct opendal_metadata_user_metadata * | metadata | ) |
Return the key-value pairs of the user metadata.
| char * opendal_metadata_version | ( | const struct opendal_metadata * | self | ) |
Return this entry's service-specific version identifier.
| struct opendal_error * opendal_operator_check | ( | const struct opendal_operator * | op | ) |
Check whether the operator works properly.
| struct opendal_error * opendal_operator_check_with_cancel | ( | const struct opendal_operator * | op, |
| const struct opendal_cancel_token * | cancel ) |
Check whether the operator works properly, supporting optional cancellation.
Pass NULL for cancel to run without cancellation.
| struct opendal_error * opendal_operator_copier | ( | const struct opendal_operator * | op, |
| const char * | src, | ||
| const char * | dest, | ||
| struct opendal_copier ** | copier ) |
Blocking create a copier to copy a file from src to dest.
The returned copier is used to complete a long-running copy operation. Call opendal_copier_next repeatedly to make progress, and opendal_copier_free to release it once finished.
| op | The opendal_operator created previously |
| src | The designated source path you want to copy |
| dest | The designated destination path you want to copy |
| copier | Output pointer receiving the allocated opendal_copier * on success, or NULL on failure |
| struct opendal_error * opendal_operator_copier_with | ( | const struct opendal_operator * | op, |
| const char * | src, | ||
| const char * | dest, | ||
| const struct opendal_copy_options * | opts, | ||
| struct opendal_copier ** | copier ) |
Blocking create a copier to copy a file from src to dest with options.
This is the same as opendal_operator_copier but accepts an opendal_copy_options to control the behavior, e.g. concurrent or chunk. Pass NULL to use defaults.
| op | The opendal_operator created previously |
| src | The designated source path you want to copy |
| dest | The designated destination path you want to copy |
| opts | The options for the copy operation; pass NULL to use defaults |
| copier | Output pointer receiving the allocated opendal_copier * on success, or NULL on failure |
| struct opendal_error * opendal_operator_copier_with_cancel | ( | const struct opendal_operator * | op, |
| const char * | src, | ||
| const char * | dest, | ||
| const struct opendal_copy_options * | opts, | ||
| const struct opendal_cancel_token * | cancel, | ||
| struct opendal_copier ** | copier ) |
Blocking create a copier to copy a file from src to dest with options and optional cancellation.
Pass NULL for opts to use defaults, and NULL for cancel to run without cancellation. On cancellation or failure, writes NULL to *copier and returns an opendal_error * (OPENDAL_CANCELLED on cancellation).
| struct opendal_error * opendal_operator_copy | ( | const struct opendal_operator * | op, |
| const char * | src, | ||
| const char * | dest ) |
Blocking copy the object in path.
Copy the object in src to dest blocking by op. Error is NULL if successful, otherwise it contains the error code and error message.
| op | The opendal_operator created previously |
| src | The designated source path you want to copy |
| dest | The designated destination path you want to copy |
Following is an example
It is safe under the cases below
| struct opendal_error * opendal_operator_copy_with | ( | const struct opendal_operator * | op, |
| const char * | src, | ||
| const char * | dest, | ||
| const struct opendal_copy_options * | opts ) |
Blocking copy the object in path with options.
Copy the object from src to dest blocking by op, using the provided opendal_copy_options to control the behavior, e.g. if_not_exists or if_match conditions.
| op | The opendal_operator created previously |
| src | The designated source path you want to copy |
| dest | The designated destination path you want to copy |
| opts | The options for the copy operation; pass NULL to use defaults |
Following is an example
It is safe under the cases below
| struct opendal_error * opendal_operator_copy_with_cancel | ( | const struct opendal_operator * | op, |
| const char * | src, | ||
| const char * | dest, | ||
| const struct opendal_copy_options * | opts, | ||
| const struct opendal_cancel_token * | cancel ) |
Blocking copy the object from src to dest with options and optional cancellation.
Pass NULL for opts to use defaults, and NULL for cancel to run without cancellation.
| struct opendal_error * opendal_operator_create_dir | ( | const struct opendal_operator * | op, |
| const char * | path ) |
Blocking create the directory in path.
Create the directory in path blocking by op_ptr. Error is NULL if successful, otherwise it contains the error code and error message.
| op | The opendal_operator created previously |
| path | The designated directory you want to create |
Following is an example
It is safe under the cases below
| struct opendal_error * opendal_operator_create_dir_with_cancel | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| const struct opendal_cancel_token * | cancel ) |
Blocking create the directory in path with optional cancellation.
Pass NULL for cancel to run without cancellation.
| struct opendal_error * opendal_operator_delete | ( | const struct opendal_operator * | op, |
| const char * | path ) |
Blocking delete the object in path.
Delete the object in path blocking by op_ptr. Error is NULL if successful, otherwise it contains the error code and error message.
| op | The opendal_operator created previously |
| path | The designated path you want to delete |
Following is an example
It is safe under the cases below
| struct opendal_error * opendal_operator_delete_with | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| const struct opendal_delete_options * | opts ) |
Blocking delete the object in path with options.
Delete the object in path blocking by op, using the provided opendal_delete_options. This is similar to opendal_operator_delete but allows specifying a version or requesting a recursive delete.
| op | The opendal_operator created previously |
| path | The designated path you want to delete |
| opts | The options for the delete operation; pass NULL to use defaults |
| struct opendal_error * opendal_operator_delete_with_cancel | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| const struct opendal_delete_options * | opts, | ||
| const struct opendal_cancel_token * | cancel ) |
Blocking delete the object in path with options and optional cancellation.
Pass NULL for opts to use defaults, and NULL for cancel to run without cancellation.
| struct opendal_error * opendal_operator_deleter | ( | const struct opendal_operator * | op, |
| struct opendal_deleter ** | deleter_out ) |
Create a blocking deleter to remove multiple paths.
Submit paths with opendal_deleter_delete or opendal_deleter_delete_many. Call opendal_deleter_flush to complete pending deletions and opendal_deleter_free to release the handle.
| op | The opendal_operator created previously |
| deleter_out | Output pointer receiving the allocated deleter on success, or NULL on failure |
| struct opendal_error * opendal_operator_deleter_with_cancel | ( | const struct opendal_operator * | op, |
| const struct opendal_cancel_token * | cancel, | ||
| struct opendal_deleter ** | deleter_out ) |
Create a blocking deleter to remove multiple paths, supporting optional cancellation.
Pass NULL for cancel to run without cancellation. On cancellation or failure, writes NULL to *deleter_out and returns an opendal_error * (OPENDAL_CANCELLED on cancellation).
| struct opendal_error * opendal_operator_exists | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| bool * | exists ) |
Check whether the path exists.
If the operation succeeds, no matter the path exists or not, the error should be a nullptr. Otherwise, the field exists is filled with false, and the error is set
| op | The opendal_operator created previously |
| path | The path you want to check existence |
| exists | Output pointer receiving whether the path exists, or false on failure |
It is safe under the cases below
| struct opendal_error * opendal_operator_exists_with_cancel | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| const struct opendal_cancel_token * | cancel, | ||
| bool * | exists ) |
Check whether the path exists, supporting optional cancellation via cancel.
Pass NULL for cancel to run without cancellation. On cancellation or failure, writes false to *exists and returns an opendal_error * (OPENDAL_CANCELLED on cancellation).
| void opendal_operator_free | ( | const struct opendal_operator * | ptr | ) |
Free the heap-allocated operator pointed by opendal_operator.
Please only use this for a pointer pointing at a valid opendal_operator. Calling this function on NULL does nothing, but calling this function on pointers of other type will lead to segfault.
| void opendal_operator_info_free | ( | struct opendal_operator_info * | ptr | ) |
Free the heap-allocated opendal_operator_info.
| void opendal_operator_info_get_capability | ( | const struct opendal_operator_info * | self, |
| struct opendal_capability * | cap ) |
Write the operator's capability into cap.
| char * opendal_operator_info_get_name | ( | const struct opendal_operator_info * | self | ) |
Return the nul-terminated operator backend's name, could be empty if underlying backend has no namespace concept.
| char * opendal_operator_info_get_root | ( | const struct opendal_operator_info * | self | ) |
Return the nul-terminated operator's working root path.
| char * opendal_operator_info_get_scheme | ( | const struct opendal_operator_info * | self | ) |
Return the nul-terminated operator's scheme, i.e. service.
| struct opendal_operator_info * opendal_operator_info_new | ( | const struct opendal_operator * | op | ) |
Get information of underlying accessor.
| struct opendal_error * opendal_operator_is_exist | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| bool * | is_exist ) |
Check whether the path exists.
If the operation succeeds, no matter the path exists or not, the error should be a nullptr. Otherwise, the field is_exist is filled with false, and the error is set
| op | The opendal_operator created previously |
| path | The path you want to check existence |
| is_exist | Output pointer receiving whether the path exists, or false on failure |
It is safe under the cases below
| void opendal_operator_layers_add_retry | ( | struct opendal_operator_layers * | layers, |
| bool | jitter, | ||
| float | factor, | ||
| uint64_t | min_delay_ns, | ||
| uint64_t | max_delay_ns, | ||
| uint64_t | max_times ) |
Add a retry layer.
| void opendal_operator_layers_add_timeout | ( | struct opendal_operator_layers * | layers, |
| uint64_t | timeout_ns, | ||
| uint64_t | io_timeout_ns ) |
Add a timeout layer.
| void opendal_operator_layers_free | ( | struct opendal_operator_layers * | ptr | ) |
Free the allocated memory used by opendal_operator_layers.
| struct opendal_operator_layers * opendal_operator_layers_new | ( | void | ) |
Construct a heap-allocated opendal_operator_layers.
| struct opendal_error * opendal_operator_list | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| struct opendal_lister ** | lister ) |
Blocking list the objects in path.
List the object in path blocking by op_ptr, writing the constructed opendal_lister * to *lister. Users should call opendal_lister_next() on the lister.
| op | The opendal_operator created previously |
| path | The designated path you want to list |
| lister | Output pointer receiving the allocated opendal_lister * on success, or NULL on failure |
Following is an example
It is safe under the cases below
| struct opendal_error * opendal_operator_list_with | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| const struct opendal_list_options * | opts, | ||
| struct opendal_lister ** | lister ) |
Blocking list the objects in path with options.
List the objects in path with the provided opendal_list_options. This is similar to opendal_operator_list but allows passing options such as recursive to control the listing behavior.
| op | The opendal_operator created previously |
| path | The designated path you want to list |
| opts | The options for the list operation; pass NULL to use defaults |
| lister | Output pointer receiving the allocated opendal_lister * on success, or NULL on failure |
| struct opendal_error * opendal_operator_list_with_cancel | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| const struct opendal_list_options * | opts, | ||
| const struct opendal_cancel_token * | cancel, | ||
| struct opendal_lister ** | lister ) |
Blocking list the objects in path with options and optional cancellation.
Pass NULL for opts to use defaults, and NULL for cancel to run without cancellation. On cancellation or failure, writes NULL to *lister and returns an opendal_error * (OPENDAL_CANCELLED on cancellation).
| struct opendal_error * opendal_operator_new | ( | const char * | scheme, |
| const struct opendal_operator_options * | options, | ||
| struct opendal_operator ** | op ) |
Construct an operator based on scheme and options.
Pass service configuration and any context.<name>.*, layers, and layer.<name>.* options as key-value pairs from trusted sources. The linked library must include the selected service and configured providers.
The layers option lists layer names from inner to outer, separated by commas. This constructor appends the C binding's default retry and logging layers after the configured layers. In particular, layers=retry adds an inner retry layer beneath the default retry layer. Use opendal_operator_new_with_layers() with layers set to NULL to use only the configured layers in addition to OpenDAL's core layers.
| scheme | the service scheme you want to specify, e.g. "fs", "s3" |
| options | the pointer to the options for this operator, it could be NULL, which means no option is set |
| op | output pointer receiving the newly allocated opendal_operator * on success, or NULL on failure |
Following is an example.
scheme must be a valid nul-terminated C string and op must be a valid, aligned, writable pointer.
| struct opendal_error * opendal_operator_new_with_layers | ( | const char * | scheme, |
| const struct opendal_operator_options * | options, | ||
| const struct opendal_operator_layers * | layers, | ||
| struct opendal_operator ** | op ) |
Construct an operator based on scheme, options, and explicit layers.
This constructor uses the same configuration options as opendal_operator_new(). It appends the layers in the C handle in insertion order, after any layers configured in options. Pass NULL for the C handle to keep only the configured layers and OpenDAL's core layers.
This constructor omits the C binding's default retry and logging layers.
| scheme | The service scheme. |
| options | The configuration options, or NULL to use defaults. |
| layers | The C layer handle, or NULL to append no explicit layers. |
| op | Output pointer receiving the newly allocated opendal_operator * on success, or NULL on failure. |
scheme must be a valid nul-terminated C string and op must be a valid, aligned, writable pointer.
| void opendal_operator_options_free | ( | struct opendal_operator_options * | ptr | ) |
Free the allocated memory used by [opendal_operator_options].
| struct opendal_operator_options * opendal_operator_options_new | ( | void | ) |
Construct a heap-allocated opendal_operator_options.
| void opendal_operator_options_set | ( | struct opendal_operator_options * | opts, |
| const char * | key, | ||
| const char * | value ) |
Set a Key-Value pair inside opendal_operator_options.
This function is unsafe because it dereferences and casts the raw pointers Make sure the pointer of key and value point to a valid string.
| struct opendal_error * opendal_operator_presign_delete | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| uint64_t | expire_secs, | ||
| struct opendal_presigned_request ** | req ) |
Presign a delete operation.
req must point to writable storage for a request pointer. On success, writes the request to *req and returns NULL; free the request with opendal_presigned_request_free(). On failure, writes NULL to *req and returns an error that must be freed with opendal_error_free().
| struct opendal_error * opendal_operator_presign_delete_with | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| uint64_t | expire_secs, | ||
| const struct opendal_delete_options * | opts, | ||
| struct opendal_presigned_request ** | req ) |
Presign a delete operation with options.
req must point to writable storage for a request pointer. On success, writes the request to *req and returns NULL; free the request with opendal_presigned_request_free(). On failure, writes NULL to *req and returns an error that must be freed with opendal_error_free().
| struct opendal_error * opendal_operator_presign_delete_with_cancel | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| uint64_t | expire_secs, | ||
| const struct opendal_delete_options * | opts, | ||
| const struct opendal_cancel_token * | cancel, | ||
| struct opendal_presigned_request ** | req ) |
Presign a delete operation with options and optional cancellation.
Pass NULL for opts to use defaults, and NULL for cancel to run without cancellation. On cancellation or failure, writes NULL to *req and returns an opendal_error * (OPENDAL_CANCELLED on cancellation).
| struct opendal_error * opendal_operator_presign_read | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| uint64_t | expire_secs, | ||
| struct opendal_presigned_request ** | req ) |
Presign a read operation.
req must point to writable storage for a request pointer. On success, writes the request to *req and returns NULL; free the request with opendal_presigned_request_free(). On failure, writes NULL to *req and returns an error that must be freed with opendal_error_free().
| struct opendal_error * opendal_operator_presign_read_with | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| uint64_t | expire_secs, | ||
| const struct opendal_read_options * | opts, | ||
| struct opendal_presigned_request ** | req ) |
Presign a read operation with options.
req must point to writable storage for a request pointer. On success, writes the request to *req and returns NULL; free the request with opendal_presigned_request_free(). On failure, writes NULL to *req and returns an error that must be freed with opendal_error_free().
| struct opendal_error * opendal_operator_presign_read_with_cancel | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| uint64_t | expire_secs, | ||
| const struct opendal_read_options * | opts, | ||
| const struct opendal_cancel_token * | cancel, | ||
| struct opendal_presigned_request ** | req ) |
Presign a read operation with options and optional cancellation.
Pass NULL for opts to use defaults, and NULL for cancel to run without cancellation. On cancellation or failure, writes NULL to *req and returns an opendal_error * (OPENDAL_CANCELLED on cancellation).
| struct opendal_error * opendal_operator_presign_stat | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| uint64_t | expire_secs, | ||
| struct opendal_presigned_request ** | req ) |
Presign a stat operation.
req must point to writable storage for a request pointer. On success, writes the request to *req and returns NULL; free the request with opendal_presigned_request_free(). On failure, writes NULL to *req and returns an error that must be freed with opendal_error_free().
| struct opendal_error * opendal_operator_presign_stat_with | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| uint64_t | expire_secs, | ||
| const struct opendal_stat_options * | opts, | ||
| struct opendal_presigned_request ** | req ) |
Presign a stat operation with options.
req must point to writable storage for a request pointer. On success, writes the request to *req and returns NULL; free the request with opendal_presigned_request_free(). On failure, writes NULL to *req and returns an error that must be freed with opendal_error_free().
| struct opendal_error * opendal_operator_presign_stat_with_cancel | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| uint64_t | expire_secs, | ||
| const struct opendal_stat_options * | opts, | ||
| const struct opendal_cancel_token * | cancel, | ||
| struct opendal_presigned_request ** | req ) |
Presign a stat operation with options and optional cancellation.
Pass NULL for opts to use defaults, and NULL for cancel to run without cancellation. On cancellation or failure, writes NULL to *req and returns an opendal_error * (OPENDAL_CANCELLED on cancellation).
| struct opendal_error * opendal_operator_presign_write | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| uint64_t | expire_secs, | ||
| struct opendal_presigned_request ** | req ) |
Presign a write operation.
req must point to writable storage for a request pointer. On success, writes the request to *req and returns NULL; free the request with opendal_presigned_request_free(). On failure, writes NULL to *req and returns an error that must be freed with opendal_error_free().
| struct opendal_error * opendal_operator_presign_write_with | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| uint64_t | expire_secs, | ||
| const struct opendal_write_options * | opts, | ||
| struct opendal_presigned_request ** | req ) |
Presign a write operation with options.
req must point to writable storage for a request pointer. On success, writes the request to *req and returns NULL; free the request with opendal_presigned_request_free(). On failure, writes NULL to *req and returns an error that must be freed with opendal_error_free().
| struct opendal_error * opendal_operator_presign_write_with_cancel | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| uint64_t | expire_secs, | ||
| const struct opendal_write_options * | opts, | ||
| const struct opendal_cancel_token * | cancel, | ||
| struct opendal_presigned_request ** | req ) |
Presign a write operation with options and optional cancellation.
Pass NULL for opts to use defaults, and NULL for cancel to run without cancellation. On cancellation or failure, writes NULL to *req and returns an opendal_error * (OPENDAL_CANCELLED on cancellation).
| struct opendal_error * opendal_operator_read | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| struct opendal_bytes * | bytes ) |
Blocking read the data from path.
Read the data out from path blocking by operator.
| op | The opendal_operator created previously |
| path | The path you want to read the data out |
| bytes | Output pointer receiving the newly allocated opendal_bytes on success, or an empty opendal_bytes on failure |
Following is an example
It is safe under the cases below
| struct opendal_error * opendal_operator_read_with | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| const struct opendal_read_options * | opts, | ||
| struct opendal_bytes * | bytes ) |
Blocking read the data from path with options.
Read the data out from path blocking by operator, using the provided opendal_read_options to control the behavior, e.g. range, version, or conditional headers.
| op | The opendal_operator created previously |
| path | The path you want to read the data out |
| opts | The options for the read operation; pass NULL to use defaults |
| bytes | Output pointer receiving the newly allocated opendal_bytes on success, or an empty opendal_bytes on failure |
It is safe under the cases below
| struct opendal_error * opendal_operator_read_with_cancel | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| const struct opendal_read_options * | opts, | ||
| const struct opendal_cancel_token * | cancel, | ||
| struct opendal_bytes * | bytes ) |
Blocking read the data from path with options and optional cancellation.
Pass NULL for opts to use defaults, and NULL for cancel to run without cancellation. On cancellation or failure, writes an empty opendal_bytes to *bytes and returns an opendal_error * (OPENDAL_CANCELLED on cancellation).
| struct opendal_error * opendal_operator_reader | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| struct opendal_reader ** | reader ) |
Blocking create a reader for the specified path.
| op | The opendal_operator created previously |
| path | The path you want to read the data out |
| reader | Output pointer receiving the allocated opendal_reader * on success, or NULL on failure |
Following is an example
It is safe under the cases below
| struct opendal_error * opendal_operator_reader_with | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| const struct opendal_reader_options * | opts, | ||
| struct opendal_reader ** | reader ) |
Blocking create a reader for the specified path with options.
This function prepares a reader, applying the conditional, version and concurrency options carried by opts. A NULL opts is treated as the default options, behaving like opendal_operator_reader.
| op | The opendal_operator created previously |
| path | The designated path where the reader will be used |
| opts | The reader options, or NULL to use the defaults |
| reader | Output pointer receiving the allocated opendal_reader * on success, or NULL on failure |
It is safe under the cases below
| struct opendal_error * opendal_operator_reader_with_cancel | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| const struct opendal_reader_options * | opts, | ||
| const struct opendal_cancel_token * | cancel, | ||
| struct opendal_reader ** | reader ) |
Blocking create a reader for the specified path with options and optional cancellation.
Pass NULL for opts to use defaults, and NULL for cancel to run without cancellation. On cancellation or failure, writes NULL to *reader and returns an opendal_error * (OPENDAL_CANCELLED on cancellation).
| struct opendal_error * opendal_operator_rename | ( | const struct opendal_operator * | op, |
| const char * | src, | ||
| const char * | dest ) |
Blocking rename the object in path.
Rename the object in src to dest blocking by op. Error is NULL if successful, otherwise it contains the error code and error message.
| op | The opendal_operator created previously |
| src | The designated source path you want to rename |
| dest | The designated destination path you want to rename |
Following is an example
It is safe under the cases below
| struct opendal_error * opendal_operator_rename_with_cancel | ( | const struct opendal_operator * | op, |
| const char * | src, | ||
| const char * | dest, | ||
| const struct opendal_cancel_token * | cancel ) |
Blocking rename the object from src to dest with optional cancellation.
Pass NULL for cancel to run without cancellation.
| struct opendal_error * opendal_operator_stat | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| struct opendal_metadata ** | meta ) |
Stat the path, return its metadata.
Error is NULL if successful, otherwise it contains the error code and error message.
| op | The opendal_operator created previously |
| path | The path you want to stat |
| meta | Output pointer receiving the allocated opendal_metadata * on success, or NULL on failure |
It is safe under the cases below
| struct opendal_error * opendal_operator_stat_with | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| const struct opendal_stat_options * | opts, | ||
| struct opendal_metadata ** | meta ) |
Blocking stat the object in path with options.
Stat the object in path with the provided opendal_stat_options. This is similar to opendal_operator_stat but allows passing options such as version, if_match, if_none_match, or response header overrides.
| op | The opendal_operator created previously |
| path | The path you want to stat |
| opts | The options for the stat operation; pass NULL to use defaults |
| meta | Output pointer receiving the allocated opendal_metadata * on success, or NULL on failure |
| struct opendal_error * opendal_operator_stat_with_cancel | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| const struct opendal_stat_options * | opts, | ||
| const struct opendal_cancel_token * | cancel, | ||
| struct opendal_metadata ** | meta ) |
Blocking stat the object in path with options and optional cancellation.
Pass NULL for opts to use defaults, and NULL for cancel to run without cancellation. On cancellation or failure, writes NULL to *meta and returns an opendal_error * (OPENDAL_CANCELLED on cancellation).
| struct opendal_error * opendal_operator_write | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| const struct opendal_bytes * | bytes ) |
Blocking write raw bytes to path.
Write the bytes into the path blocking by op_ptr. Error is NULL if successful, otherwise it contains the error code and error message.
| op | The opendal_operator created previously |
| path | The designated path you want to write your bytes in |
| bytes | The opendal_byte typed bytes to be written |
Following is an example
It is safe under the cases below
| struct opendal_error * opendal_operator_write_with | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| const struct opendal_bytes * | bytes, | ||
| const struct opendal_write_options * | opts ) |
Blocking write raw bytes to path with options.
| struct opendal_error * opendal_operator_write_with_cancel | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| const struct opendal_bytes * | bytes, | ||
| const struct opendal_write_options * | opts, | ||
| const struct opendal_cancel_token * | cancel, | ||
| struct opendal_metadata ** | meta ) |
Blocking write raw bytes to path with options, optional cancellation, and optional metadata output.
Pass NULL for opts to use defaults, NULL for cancel to run without cancellation, and NULL for meta to discard the written object's metadata. When meta is non-null, *meta receives the allocated opendal_metadata * on success, or NULL on cancellation or failure.
| op | The opendal_operator created previously |
| path | The designated path where the data will be written |
| bytes | The data to write |
| opts | The write options, or NULL to use the defaults |
| cancel | Optional cancel token, or NULL |
| meta | Optional output pointer receiving the allocated opendal_metadata *, or NULL |
| struct opendal_error * opendal_operator_write_with_metadata | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| const struct opendal_bytes * | bytes, | ||
| const struct opendal_write_options * | opts, | ||
| struct opendal_metadata ** | meta ) |
Blocking write raw bytes to path, returning the written object's metadata.
Like opendal_operator_write_with, but on success writes the metadata of the just-written object (e.g. etag, version, last modified) to *meta instead of discarding it. A NULL opts is treated as the default options, behaving like a plain write.
| op | The opendal_operator created previously |
| path | The designated path where the data will be written |
| bytes | The data to write |
| opts | The write options, or NULL to use the defaults |
| meta | Output pointer receiving the allocated opendal_metadata * on success, or NULL on failure |
It is safe under the cases below
| struct opendal_error * opendal_operator_writer | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| struct opendal_writer ** | writer ) |
Blocking create a writer for the specified path.
This function prepares a writer that can be used to write data to the specified path using the provided operator.
| op | The opendal_operator created previously |
| path | The designated path where the writer will be used |
| writer | Output pointer receiving the allocated opendal_writer * on success, or NULL on failure |
Following is an example
It is safe under the cases below
| struct opendal_error * opendal_operator_writer_with | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| const struct opendal_write_options * | opts, | ||
| struct opendal_writer ** | writer ) |
Blocking create a writer for the specified path with options.
| struct opendal_error * opendal_operator_writer_with_cancel | ( | const struct opendal_operator * | op, |
| const char * | path, | ||
| const struct opendal_write_options * | opts, | ||
| const struct opendal_cancel_token * | cancel, | ||
| struct opendal_writer ** | writer ) |
Blocking create a writer for the specified path with options and optional cancellation.
Pass NULL for opts to use defaults, and NULL for cancel to run without cancellation. On cancellation or failure, writes NULL to *writer and returns an opendal_error * (OPENDAL_CANCELLED on cancellation).
| void opendal_presigned_request_free | ( | struct opendal_presigned_request * | req | ) |
Free the presigned request.
| const struct opendal_http_header_pair * opendal_presigned_request_headers | ( | const struct opendal_presigned_request * | req | ) |
Get the headers of the presigned request.
| uintptr_t opendal_presigned_request_headers_len | ( | const struct opendal_presigned_request * | req | ) |
Get the length of the headers of the presigned request.
| const char * opendal_presigned_request_method | ( | const struct opendal_presigned_request * | req | ) |
Get the method of the presigned request.
| const char * opendal_presigned_request_uri | ( | const struct opendal_presigned_request * | req | ) |
Get the URI of the presigned request.
| void opendal_read_options_free | ( | struct opendal_read_options * | opts | ) |
Free the heap memory used by opendal_read_options.
| opts | The opendal_read_options to free. |
| struct opendal_read_options * opendal_read_options_new | ( | void | ) |
Construct a heap-allocated opendal_read_options with default values.
| void opendal_read_options_set_chunk | ( | struct opendal_read_options * | opts, |
| uintptr_t | chunk ) |
Set chunk.
Set chunk for the operation.
By default, OpenDAL reads the range with a single request instead of in chunks. Users can set chunk based on their own needs. 0 has the same behavior as leaving it unset.
A read with a positive chunk and an open-ended range, such as no range or one that opendal_read_options_set_range_from() sets, first stats the file to learn its length, unless content_length_hint is set. That stat carries the read's version and conditions, so each of them also needs its stat capability, such as opendal_capability.stat_with_if_modified_since for if_modified_since; otherwise the read returns OPENDAL_UNSUPPORTED.
The setter also sets has_chunk.
| opts | The opendal_read_options to modify. |
| chunk | The value to set. |
| void opendal_read_options_set_concurrent | ( | struct opendal_read_options * | opts, |
| uintptr_t | concurrent ) |
Set concurrent.
Set concurrent for the operation.
OpenDAL reads a file without concurrency by default. This is not efficient for cases when users read large chunks of data. By setting concurrent together with chunk, opendal will read files concurrently on supported storage services.
By setting concurrent, opendal will fetch chunks concurrently with the given chunk size. Without chunk, OpenDAL does not read concurrently. 0 has the same behavior as 1.
| opts | The opendal_read_options to modify. |
| concurrent | The value to set; 0 is the default. |
| void opendal_read_options_set_content_length_hint | ( | struct opendal_read_options * | opts, |
| uint64_t | content_length_hint ) |
Set content_length_hint.
Known content length of the object.
This is an execution hint that allows OpenDAL to avoid extra metadata requests while planning reads. It must not be used as an object identity or consistency condition.
The setter also sets has_content_length_hint.
| opts | The opendal_read_options to modify. |
| content_length_hint | The value to set. |
| void opendal_read_options_set_gap | ( | struct opendal_read_options * | opts, |
| uintptr_t | gap ) |
Set gap.
A read selects one byte range, so gap, which merges nearby ranges, has no effect.
The setter also sets has_gap.
| opts | The opendal_read_options to modify. |
| gap | The value to set. |
| void opendal_read_options_set_if_match | ( | struct opendal_read_options * | opts, |
| const char * | if_match ) |
Set if_match.
Read only when the file has this exact ETag.
The condition succeeds when the file exists and its ETag equals this value. A file with a different ETag returns OPENDAL_CONDITION_NOT_MATCH; a missing file returns OPENDAL_NOT_FOUND. 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.read_with_if_match.
A non-NULL if_match must point to a readable, nul-terminated UTF-8 string. The setter stores it without copying it, so the string must stay valid until a function that takes opts, such as opendal_operator_read_with(), returns.
| opts | The opendal_read_options to modify. |
| if_match | The string to borrow; NULL unsets it. |
| void opendal_read_options_set_if_modified_since | ( | struct opendal_read_options * | opts, |
| int64_t | if_modified_since ) |
Set if_modified_since.
Read only when the file was modified after this timestamp.
The condition succeeds when the file exists and was modified after this time. A file not modified since this time returns OPENDAL_CONDITION_NOT_MATCH; a missing file returns OPENDAL_NOT_FOUND.
The operation returns OPENDAL_UNSUPPORTED when the service does not advertise opendal_capability.read_with_if_modified_since.
The setter also sets has_if_modified_since. A value out of range fails the operation with OPENDAL_CONFIG_INVALID.
| opts | The opendal_read_options to modify. |
| if_modified_since | Milliseconds since the Unix epoch. |
| void opendal_read_options_set_if_none_match | ( | struct opendal_read_options * | opts, |
| const char * | if_none_match ) |
Set if_none_match.
Read only when the file does not have this ETag.
With a concrete ETag value, the condition succeeds when the file exists with a different ETag. A file whose ETag equals this value returns OPENDAL_CONDITION_NOT_MATCH; a missing file returns OPENDAL_NOT_FOUND. 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.read_with_if_none_match.
A non-NULL if_none_match must point to a readable, nul-terminated UTF-8 string. The setter stores it without copying it, so the string must stay valid until a function that takes opts, such as opendal_operator_read_with(), returns.
| opts | The opendal_read_options to modify. |
| if_none_match | The string to borrow; NULL unsets it. |
| void opendal_read_options_set_if_unmodified_since | ( | struct opendal_read_options * | opts, |
| int64_t | if_unmodified_since ) |
Set if_unmodified_since.
Read only when the file was not modified after this timestamp.
The condition succeeds when the file exists and was not modified after this time. A file modified after this time returns OPENDAL_CONDITION_NOT_MATCH; a missing file returns OPENDAL_NOT_FOUND.
The operation returns OPENDAL_UNSUPPORTED when the service does not advertise opendal_capability.read_with_if_unmodified_since.
The setter also sets has_if_unmodified_since. A value out of range fails the operation with OPENDAL_CONFIG_INVALID.
| opts | The opendal_read_options to modify. |
| if_unmodified_since | Milliseconds since the Unix epoch. |
| void opendal_read_options_set_override_cache_control | ( | struct opendal_read_options * | opts, |
| const char * | override_cache_control ) |
Set override_cache_control.
Request a cache-control response header override from services that support it, including for presigned read requests.
A non-NULL override_cache_control must point to a readable, nul-terminated UTF-8 string. The setter stores it without copying it, so the string must stay valid until a function that takes opts, such as opendal_operator_read_with(), returns.
| opts | The opendal_read_options to modify. |
| override_cache_control | The string to borrow; NULL unsets it. |
| void opendal_read_options_set_override_content_disposition | ( | struct opendal_read_options * | opts, |
| const char * | override_content_disposition ) |
Set override_content_disposition.
Request a content-disposition response header override from services that support it, including for presigned read requests.
A non-NULL override_content_disposition must point to a readable, nul-terminated UTF-8 string. The setter stores it without copying it, so the string must stay valid until a function that takes opts, such as opendal_operator_read_with(), returns.
| opts | The opendal_read_options to modify. |
| override_content_disposition | The string to borrow; NULL unsets it. |
| void opendal_read_options_set_override_content_type | ( | struct opendal_read_options * | opts, |
| const char * | override_content_type ) |
Set override_content_type.
Request a content-type response header override from services that support it, including for presigned read requests.
A non-NULL override_content_type must point to a readable, nul-terminated UTF-8 string. The setter stores it without copying it, so the string must stay valid until a function that takes opts, such as opendal_operator_read_with(), returns.
| opts | The opendal_read_options to modify. |
| override_content_type | The string to borrow; NULL unsets it. |
| void opendal_read_options_set_range | ( | struct opendal_read_options * | opts, |
| uint64_t | offset, | ||
| uint64_t | length ) |
Set the range to length bytes from offset.
Read from this byte offset instead of from the start of the file.
An offset at or beyond the end of the file can return an empty buffer or fail the read, depending on the service and on chunk.
Read this many bytes from offset.
A length of 0 validates the other options, then returns an empty buffer without accessing storage. When length is positive, a file that ends before offset plus length fails the read.
The setter also sets has_length.
| opts | The opendal_read_options to modify. |
| offset | The byte offset to read from. |
| length | The number of bytes to read. |
| void opendal_read_options_set_range_from | ( | struct opendal_read_options * | opts, |
| uint64_t | offset ) |
Set the range to start at offset and continue to the end of the file.
Read from this byte offset instead of from the start of the file.
An offset at or beyond the end of the file can return an empty buffer or fail the read, depending on the service and on chunk.
The setter also clears has_length and sets length to 0.
| opts | The opendal_read_options to modify. |
| offset | The byte offset to read from. |
| void opendal_read_options_set_version | ( | struct opendal_read_options * | opts, |
| const char * | version ) |
Set version.
Read the given version of the file instead of the current one.
This selects which stored version the read returns; it is not a condition on the file. A version that does not exist returns OPENDAL_NOT_FOUND.
Check opendal_capability.read_with_version before using this option.
A non-NULL version must point to a readable, nul-terminated UTF-8 string. The setter stores it without copying it, so the string must stay valid until a function that takes opts, such as opendal_operator_read_with(), returns.
| opts | The opendal_read_options to modify. |
| version | The string to borrow; NULL unsets it. |
| void opendal_reader_free | ( | struct opendal_reader * | ptr | ) |
Frees the heap memory used by the opendal_reader.
| void opendal_reader_options_free | ( | struct opendal_reader_options * | opts | ) |
Free the heap memory used by opendal_reader_options.
| opts | The opendal_reader_options to free. |
| struct opendal_reader_options * opendal_reader_options_new | ( | void | ) |
Construct a heap-allocated opendal_reader_options with default values.
| void opendal_reader_options_set_chunk | ( | struct opendal_reader_options * | opts, |
| uintptr_t | chunk ) |
Set chunk.
Set chunk for the operation.
By default, OpenDAL reads each range with a single request instead of in chunks. Users can set chunk based on their own needs. 0 has the same behavior as leaving it unset.
opendal_operator_reader_with() with a positive chunk first stats the file to learn its length, unless content_length_hint is set. That stat carries the reader's version and conditions, so each of them also needs its stat capability, such as opendal_capability.stat_with_if_modified_since for if_modified_since; otherwise opendal_operator_reader_with() returns OPENDAL_UNSUPPORTED.
The setter also sets has_chunk.
| opts | The opendal_reader_options to modify. |
| chunk | The value to set. |
| void opendal_reader_options_set_concurrent | ( | struct opendal_reader_options * | opts, |
| uintptr_t | concurrent ) |
Set concurrent.
Set concurrent for the operation.
OpenDAL reads a file without concurrency by default. This is not efficient for cases when users read large chunks of data. By setting concurrent together with chunk, opendal will read files concurrently on supported storage services.
By setting concurrent, opendal will fetch chunks concurrently with the given chunk size. Without chunk, a reader from opendal_operator_reader_with() does not read concurrently. 0 has the same behavior as 1.
| opts | The opendal_reader_options to modify. |
| concurrent | The value to set; 0 is the default. |
| void opendal_reader_options_set_content_length_hint | ( | struct opendal_reader_options * | opts, |
| uint64_t | content_length_hint ) |
Set content_length_hint.
Known content length of the object.
This is an execution hint that allows OpenDAL to avoid extra metadata requests while planning reads. It must not be used as an object identity or consistency condition.
The setter also sets has_content_length_hint.
| opts | The opendal_reader_options to modify. |
| content_length_hint | The value to set. |
| void opendal_reader_options_set_gap | ( | struct opendal_reader_options * | opts, |
| uintptr_t | gap ) |
Set gap.
The reader reads the whole file as one range, so gap, which merges nearby ranges, has no effect.
The setter also sets has_gap.
| opts | The opendal_reader_options to modify. |
| gap | The value to set. |
| void opendal_reader_options_set_if_match | ( | struct opendal_reader_options * | opts, |
| const char * | if_match ) |
Set if_match.
Read only when the file has this exact ETag.
The condition succeeds when the file exists and its ETag equals this value. A file with a different ETag returns OPENDAL_CONDITION_NOT_MATCH; a missing file returns OPENDAL_NOT_FOUND. 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.read_with_if_match.
A non-NULL if_match must point to a readable, nul-terminated UTF-8 string. The setter stores it without copying it, so the string must stay valid until a function that takes opts, such as opendal_operator_reader_with(), returns.
| opts | The opendal_reader_options to modify. |
| if_match | The string to borrow; NULL unsets it. |
| void opendal_reader_options_set_if_modified_since | ( | struct opendal_reader_options * | opts, |
| int64_t | if_modified_since ) |
Set if_modified_since.
Read only when the file was modified after this timestamp.
The condition succeeds when the file exists and was modified after this time. A file not modified since this time returns OPENDAL_CONDITION_NOT_MATCH; a missing file returns OPENDAL_NOT_FOUND.
The operation returns OPENDAL_UNSUPPORTED when the service does not advertise opendal_capability.read_with_if_modified_since.
The setter also sets has_if_modified_since. A value out of range fails the operation with OPENDAL_CONFIG_INVALID.
| opts | The opendal_reader_options to modify. |
| if_modified_since | Milliseconds since the Unix epoch. |
| void opendal_reader_options_set_if_none_match | ( | struct opendal_reader_options * | opts, |
| const char * | if_none_match ) |
Set if_none_match.
Read only when the file does not have this ETag.
With a concrete ETag value, the condition succeeds when the file exists with a different ETag. A file whose ETag equals this value returns OPENDAL_CONDITION_NOT_MATCH; a missing file returns OPENDAL_NOT_FOUND. 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.read_with_if_none_match.
A non-NULL if_none_match must point to a readable, nul-terminated UTF-8 string. The setter stores it without copying it, so the string must stay valid until a function that takes opts, such as opendal_operator_reader_with(), returns.
| opts | The opendal_reader_options to modify. |
| if_none_match | The string to borrow; NULL unsets it. |
| void opendal_reader_options_set_if_unmodified_since | ( | struct opendal_reader_options * | opts, |
| int64_t | if_unmodified_since ) |
Set if_unmodified_since.
Read only when the file was not modified after this timestamp.
The condition succeeds when the file exists and was not modified after this time. A file modified after this time returns OPENDAL_CONDITION_NOT_MATCH; a missing file returns OPENDAL_NOT_FOUND.
The operation returns OPENDAL_UNSUPPORTED when the service does not advertise opendal_capability.read_with_if_unmodified_since.
The setter also sets has_if_unmodified_since. A value out of range fails the operation with OPENDAL_CONFIG_INVALID.
| opts | The opendal_reader_options to modify. |
| if_unmodified_since | Milliseconds since the Unix epoch. |
| void opendal_reader_options_set_prefetch | ( | struct opendal_reader_options * | opts, |
| uintptr_t | prefetch ) |
Set prefetch.
Controls read-ahead during concurrent range reads.
Up to prefetch finished reads can each free a slot for another range read before OpenDAL collects their results.
The default, 0, disables these extra slots. Reads already submitted under concurrent can still finish and wait to be collected.
Serial reads collect each result before starting the next read. Higher values can increase memory use.
| opts | The opendal_reader_options to modify. |
| prefetch | The value to set; 0 is the default. |
| void opendal_reader_options_set_version | ( | struct opendal_reader_options * | opts, |
| const char * | version ) |
Set version.
Read the given version of the file instead of the current one.
This selects which stored version the reader returns; it is not a condition on the file. A version that does not exist returns OPENDAL_NOT_FOUND.
Check opendal_capability.read_with_version before using this option.
A non-NULL version must point to a readable, nul-terminated UTF-8 string. The setter stores it without copying it, so the string must stay valid until a function that takes opts, such as opendal_operator_reader_with(), returns.
| opts | The opendal_reader_options to modify. |
| version | The string to borrow; NULL unsets it. |
| struct opendal_error * opendal_reader_read | ( | struct opendal_reader * | self, |
| uint8_t * | buf, | ||
| uintptr_t | len, | ||
| uintptr_t * | size ) |
Read data from the reader into buf and write the number of bytes read to *size.
At EOF, writes 0 to *size and returns NULL. On failure, writes 0 to *size and returns an opendal_error *.
| struct opendal_error * opendal_reader_read_with_cancel | ( | struct opendal_reader * | self, |
| uint8_t * | buf, | ||
| uintptr_t | len, | ||
| const struct opendal_cancel_token * | cancel, | ||
| uintptr_t * | size ) |
Read data from the reader into buf, supporting cancellation via cancel.
Pass NULL for cancel to run without cancellation. At EOF, writes 0 to *size and returns NULL. On cancellation or failure, writes 0 to *size and returns an opendal_error * (OPENDAL_CANCELLED on cancellation).
| struct opendal_error * opendal_reader_seek | ( | struct opendal_reader * | self, |
| int64_t | offset, | ||
| int32_t | whence, | ||
| uint64_t * | pos ) |
Seek to an offset, in bytes, in a stream, and write the new position to *pos.
On failure, writes 0 to *pos and returns an opendal_error *.
| struct opendal_error * opendal_reader_seek_with_cancel | ( | struct opendal_reader * | self, |
| int64_t | offset, | ||
| int32_t | whence, | ||
| const struct opendal_cancel_token * | cancel, | ||
| uint64_t * | pos ) |
Seek to an offset, in bytes, in a stream, supporting cancellation via cancel.
Pass NULL for cancel to run without cancellation. On cancellation or failure, writes 0 to *pos and returns an opendal_error * (OPENDAL_CANCELLED on cancellation).
| void opendal_stat_options_free | ( | struct opendal_stat_options * | opts | ) |
Free the heap memory used by opendal_stat_options.
| opts | The opendal_stat_options to free. |
| struct opendal_stat_options * opendal_stat_options_new | ( | void | ) |
Construct a heap-allocated opendal_stat_options with default values.
| void opendal_stat_options_set_if_match | ( | struct opendal_stat_options * | opts, |
| const char * | if_match ) |
Set if_match.
Stat only when the file has this exact ETag.
The condition succeeds when the file exists and its ETag equals this value. A file with a different ETag returns OPENDAL_CONDITION_NOT_MATCH; a missing file returns OPENDAL_NOT_FOUND. 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.stat_with_if_match.
A non-NULL if_match must point to a readable, nul-terminated UTF-8 string. The setter stores it without copying it, so the string must stay valid until a function that takes opts, such as opendal_operator_stat_with(), returns.
| opts | The opendal_stat_options to modify. |
| if_match | The string to borrow; NULL unsets it. |
| void opendal_stat_options_set_if_modified_since | ( | struct opendal_stat_options * | opts, |
| int64_t | if_modified_since ) |
Set if_modified_since.
Stat only when the file was modified after this timestamp.
The condition succeeds when the file exists and was modified after this time. A file not modified since this time returns OPENDAL_CONDITION_NOT_MATCH; a missing file returns OPENDAL_NOT_FOUND.
The operation returns OPENDAL_UNSUPPORTED when the service does not advertise opendal_capability.stat_with_if_modified_since.
The setter also sets has_if_modified_since. A value out of range fails the operation with OPENDAL_CONFIG_INVALID.
| opts | The opendal_stat_options to modify. |
| if_modified_since | Milliseconds since the Unix epoch. |
| void opendal_stat_options_set_if_none_match | ( | struct opendal_stat_options * | opts, |
| const char * | if_none_match ) |
Set if_none_match.
Stat only when the file does not have this ETag.
With a concrete ETag value, the condition succeeds when the file exists with a different ETag. A file whose ETag equals this value returns OPENDAL_CONDITION_NOT_MATCH; a missing file returns OPENDAL_NOT_FOUND. 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.stat_with_if_none_match.
A non-NULL if_none_match must point to a readable, nul-terminated UTF-8 string. The setter stores it without copying it, so the string must stay valid until a function that takes opts, such as opendal_operator_stat_with(), returns.
| opts | The opendal_stat_options to modify. |
| if_none_match | The string to borrow; NULL unsets it. |
| void opendal_stat_options_set_if_unmodified_since | ( | struct opendal_stat_options * | opts, |
| int64_t | if_unmodified_since ) |
Set if_unmodified_since.
Stat only when the file was not modified after this timestamp.
The condition succeeds when the file exists and was not modified after this time. A file modified after this time returns OPENDAL_CONDITION_NOT_MATCH; a missing file returns OPENDAL_NOT_FOUND.
The operation returns OPENDAL_UNSUPPORTED when the service does not advertise opendal_capability.stat_with_if_unmodified_since.
The setter also sets has_if_unmodified_since. A value out of range fails the operation with OPENDAL_CONFIG_INVALID.
| opts | The opendal_stat_options to modify. |
| if_unmodified_since | Milliseconds since the Unix epoch. |
| void opendal_stat_options_set_override_cache_control | ( | struct opendal_stat_options * | opts, |
| const char * | override_cache_control ) |
Set override_cache_control.
Request a cache-control response header override from services that support it, including for presigned stat requests.
A non-NULL override_cache_control must point to a readable, nul-terminated UTF-8 string. The setter stores it without copying it, so the string must stay valid until a function that takes opts, such as opendal_operator_stat_with(), returns.
| opts | The opendal_stat_options to modify. |
| override_cache_control | The string to borrow; NULL unsets it. |
| void opendal_stat_options_set_override_content_disposition | ( | struct opendal_stat_options * | opts, |
| const char * | override_content_disposition ) |
Set override_content_disposition.
Request a content-disposition response header override from services that support it, including for presigned stat requests.
A non-NULL override_content_disposition must point to a readable, nul-terminated UTF-8 string. The setter stores it without copying it, so the string must stay valid until a function that takes opts, such as opendal_operator_stat_with(), returns.
| opts | The opendal_stat_options to modify. |
| override_content_disposition | The string to borrow; NULL unsets it. |
| void opendal_stat_options_set_override_content_type | ( | struct opendal_stat_options * | opts, |
| const char * | override_content_type ) |
Set override_content_type.
Request a content-type response header override from services that support it, including for presigned stat requests.
A non-NULL override_content_type must point to a readable, nul-terminated UTF-8 string. The setter stores it without copying it, so the string must stay valid until a function that takes opts, such as opendal_operator_stat_with(), returns.
| opts | The opendal_stat_options to modify. |
| override_content_type | The string to borrow; NULL unsets it. |
| void opendal_stat_options_set_version | ( | struct opendal_stat_options * | opts, |
| const char * | version ) |
Set version.
Stat the given version of the file instead of the current one.
This selects which stored version the stat describes; it is not a condition on the file. A version that does not exist returns OPENDAL_NOT_FOUND.
Check opendal_capability.stat_with_version before using this option.
A non-NULL version must point to a readable, nul-terminated UTF-8 string. The setter stores it without copying it, so the string must stay valid until a function that takes opts, such as opendal_operator_stat_with(), returns.
| opts | The opendal_stat_options to modify. |
| version | The string to borrow; NULL unsets it. |
| void opendal_string_free | ( | char * | ptr | ) |
Frees a heap-allocated string returned by OpenDAL C APIs.
| void opendal_write_options_free | ( | struct opendal_write_options * | opts | ) |
Free the heap memory used by opendal_write_options.
| opts | The opendal_write_options to free. |
| struct opendal_write_options * opendal_write_options_new | ( | void | ) |
Construct a heap-allocated opendal_write_options with default values.
| void opendal_write_options_set_append | ( | struct opendal_write_options * | opts, |
| bool | append ) |
Set append.
Sets append mode for this operation.
Check opendal_capability.write_can_append before using this option.
This operation allows adding data to existing files instead of overwriting them.
| opts | The opendal_write_options to modify. |
| append | The value to set. |
| void opendal_write_options_set_cache_control | ( | struct opendal_write_options * | opts, |
| const char * | cache_control ) |
Set cache_control.
Sets Cache-Control header for this write operation.
Check opendal_capability.write_with_cache_control before using this feature.
This operation allows controlling caching behavior for the written content.
A non-NULL cache_control must point to a readable, nul-terminated UTF-8 string. The setter stores it without copying it, so the string must stay valid until a function that takes opts, such as opendal_operator_write_with(), returns.
| opts | The opendal_write_options to modify. |
| cache_control | The string to borrow; NULL unsets it. |
| void opendal_write_options_set_chunk | ( | struct opendal_write_options * | opts, |
| uintptr_t | chunk ) |
Set chunk.
Sets chunk size for buffered writes.
Check opendal_capability.write_multi_min_size and opendal_capability.write_multi_max_size for size limits.
Setting appropriate chunk size can:
The setter also sets has_chunk.
| opts | The opendal_write_options to modify. |
| chunk | The value to set. |
| void opendal_write_options_set_concurrent | ( | struct opendal_write_options * | opts, |
| uintptr_t | concurrent ) |
Set concurrent.
Sets concurrent write operations for this writer.
opendal_operator_write_with() without chunk passes the whole buffer to the service writer as one write. A service that splits the buffer internally, such as fs with direct_io on Linux, can write the parts concurrently.
This feature significantly improves performance when:
Setting appropriate concurrency can:
| opts | The opendal_write_options to modify. |
| concurrent | The value to set; 0 is the default. |
| void opendal_write_options_set_content_disposition | ( | struct opendal_write_options * | opts, |
| const char * | content_disposition ) |
Set content_disposition.
Sets Content-Disposition header for this write request.
Check opendal_capability.write_with_content_disposition before using this feature.
This operation allows controlling how the content should be displayed or downloaded.
A non-NULL content_disposition must point to a readable, nul-terminated UTF-8 string. The setter stores it without copying it, so the string must stay valid until a function that takes opts, such as opendal_operator_write_with(), returns.
| opts | The opendal_write_options to modify. |
| content_disposition | The string to borrow; NULL unsets it. |
| void opendal_write_options_set_content_encoding | ( | struct opendal_write_options * | opts, |
| const char * | content_encoding ) |
Set content_encoding.
Sets Content-Encoding header for this write request.
Check opendal_capability.write_with_content_encoding before using this feature.
This operation allows specifying the encoding applied to the content being written.
A non-NULL content_encoding must point to a readable, nul-terminated UTF-8 string. The setter stores it without copying it, so the string must stay valid until a function that takes opts, such as opendal_operator_write_with(), returns.
| opts | The opendal_write_options to modify. |
| content_encoding | The string to borrow; NULL unsets it. |
| void opendal_write_options_set_content_type | ( | struct opendal_write_options * | opts, |
| const char * | content_type ) |
Set content_type.
Sets Content-Type header for this write operation.
Check opendal_capability.write_with_content_type before using this feature.
This operation allows specifying the media type of the content being written.
A non-NULL content_type must point to a readable, nul-terminated UTF-8 string. The setter stores it without copying it, so the string must stay valid until a function that takes opts, such as opendal_operator_write_with(), returns.
| opts | The opendal_write_options to modify. |
| content_type | The string to borrow; NULL unsets it. |
| void opendal_write_options_set_if_match | ( | struct opendal_write_options * | opts, |
| const char * | if_match ) |
Set if_match.
Write only when the file at the write path has this exact ETag.
The condition succeeds when the file exists and its ETag equals this value. A file with a different ETag, or a missing file, fails the write 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.write_with_if_match.
A non-NULL if_match must point to a readable, nul-terminated UTF-8 string. The setter stores it without copying it, so the string must stay valid until a function that takes opts, such as opendal_operator_write_with(), returns.
| opts | The opendal_write_options to modify. |
| if_match | The string to borrow; NULL unsets it. |
| void opendal_write_options_set_if_none_match | ( | struct opendal_write_options * | opts, |
| const char * | if_none_match ) |
Set if_none_match.
Write only when the file at the write path does not have this ETag.
With a concrete ETag value, the condition succeeds when the file has a different ETag or does not exist; the write then replaces or creates the file. A file whose ETag equals this value fails the write 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.write_with_if_none_match. Some services, such as s3, support if_not_exists but not if_none_match; use if_not_exists when you only need to guard against an existing file.
A non-NULL if_none_match must point to a readable, nul-terminated UTF-8 string. The setter stores it without copying it, so the string must stay valid until a function that takes opts, such as opendal_operator_write_with(), returns.
| opts | The opendal_write_options to modify. |
| if_none_match | The string to borrow; NULL unsets it. |
| void opendal_write_options_set_if_not_exists | ( | struct opendal_write_options * | opts, |
| bool | if_not_exists ) |
Set if_not_exists.
Write only when no file exists at the write path.
The condition succeeds when the path is empty, so the write creates the file. An existing file fails the write with OPENDAL_CONDITION_NOT_MATCH.
The operation returns OPENDAL_UNSUPPORTED when the service does not advertise opendal_capability.write_with_if_not_exists.
| opts | The opendal_write_options to modify. |
| if_not_exists | The value to set. |
| void opendal_write_options_set_user_metadata | ( | struct opendal_write_options * | opts, |
| const struct opendal_write_user_metadata_pair * | pairs, | ||
| uintptr_t | len ) |
Set user_metadata.
Sets user metadata for this write request.
Check opendal_capability.write_with_user_metadata before using this feature.
User metadata provides a way to attach custom metadata to objects during write operations. When the service exposes user metadata, opendal_metadata_get_user_metadata() on the result of a later opendal_operator_stat() returns it.
The setter stores pairs without copying the pairs or their strings, so they must stay valid until a function that takes opts, such as opendal_operator_write_with(), returns. A pair whose key or value is NULL is skipped, and a later pair replaces an earlier pair with the same key.
| opts | The opendal_write_options to modify. |
| pairs | The pairs to borrow; NULL unsets it. |
| len | The number of pairs at pairs; 0 unsets it. |
| struct opendal_error * opendal_writer_close | ( | struct opendal_writer * | ptr | ) |
Close the writer and make sure all data have been stored.
| struct opendal_error * opendal_writer_close_with_cancel | ( | struct opendal_writer * | ptr, |
| const struct opendal_cancel_token * | cancel, | ||
| struct opendal_metadata ** | meta ) |
Close the writer, supporting cancellation via cancel and optional metadata output.
Pass NULL for cancel to run without cancellation. Pass NULL for meta to discard the written object's metadata; when non-null, *meta receives the allocated opendal_metadata * on success or NULL on cancellation or failure.
If cancelled mid-flight, the finalization state on the backend is unknown; release the handle with opendal_writer_free and start a new writer instead of continuing to write or close, which can duplicate or corrupt data on streaming or append backends.
| ptr | The opendal_writer to close (NULL is a no-op returning NULL) |
| cancel | Optional cancel token, or NULL |
| meta | Optional output pointer for the written object's metadata, or NULL |
| struct opendal_error * opendal_writer_close_with_metadata | ( | struct opendal_writer * | ptr, |
| struct opendal_metadata ** | meta ) |
Close the writer and write the written object's metadata to *meta.
Like opendal_writer_close, but on success writes the metadata of the written object (e.g. etag, version, last modified) to *meta instead of discarding it.
| ptr | The opendal_writer to close |
| meta | Output pointer receiving the allocated opendal_metadata * on success, or NULL on failure |
| void opendal_writer_free | ( | struct opendal_writer * | ptr | ) |
Frees the heap memory used by the opendal_writer.
| struct opendal_error * opendal_writer_write | ( | struct opendal_writer * | self, |
| const struct opendal_bytes * | bytes, | ||
| uintptr_t * | size ) |
Write data to the writer and write the number of bytes written to *size.
On failure, writes 0 to *size and returns an opendal_error *.
| struct opendal_error * opendal_writer_write_with_cancel | ( | struct opendal_writer * | self, |
| const struct opendal_bytes * | bytes, | ||
| const struct opendal_cancel_token * | cancel, | ||
| uintptr_t * | size ) |
Write data to the writer, supporting cancellation via cancel.
Pass NULL for cancel to run without cancellation. On cancellation or failure, writes 0 to *size and returns an opendal_error * (OPENDAL_CANCELLED on cancellation).
If cancelled mid-flight, the backend may already have accepted part or all of the write; release the handle with opendal_writer_free and start a new writer instead of continuing to write or close, which can duplicate or corrupt data on streaming or append backends.