Apache OpenDALâ„¢ C Binding
The C binding for Apache OpenDALâ„¢
Loading...
Searching...
No Matches
opendal.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20
21#ifndef _OPENDAL_H
22#define _OPENDAL_H
23
24#include <stdint.h>
25#include <stddef.h>
26#include <stdbool.h>
27
28#define OPENDAL_SEEK_SET 0
29
30#define OPENDAL_SEEK_CUR 1
31
32#define OPENDAL_SEEK_END 2
33
89
91
101typedef struct opendal_bytes {
105 uint8_t *data;
109 uintptr_t len;
113 uintptr_t capacity;
115
139
148typedef struct opendal_entry {
153 void *inner;
155
173
190
209
230
253
271
290
304
321
334
350
371
392
410
428
440
591
599
613
621 const char *key;
625 const char *value;
627
643
659
675
676#ifdef __cplusplus
677extern "C" {
678#endif // __cplusplus
679
684
695
700
705
720
735
755
770
789
830 const struct opendal_operator_options *options);
831
879 const char *path,
880 const struct opendal_bytes *bytes);
881
924 const char *path);
925
965 const char *path);
966
1006 const char *path);
1007
1050struct opendal_error *opendal_operator_delete(const struct opendal_operator *op, const char *path);
1051
1092 const char *path);
1093
1134 const char *path);
1135
1175 const char *path);
1176
1228 const char *path);
1229
1266 const char *path);
1267
1312 const char *src,
1313 const char *dest);
1314
1359 const char *src,
1360 const char *dest);
1361
1363
1383
1388
1395
1402
1410
1415
1420
1425 const char *path,
1426 uint64_t expire_secs);
1427
1432 const char *path,
1433 uint64_t expire_secs);
1434
1439 const char *path,
1440 uint64_t expire_secs);
1441
1446 const char *path,
1447 uint64_t expire_secs);
1448
1453
1458
1463
1468
1473
1478
1488
1509 const char *key,
1510 const char *value);
1511
1516
1524char *opendal_entry_path(const struct opendal_entry *self);
1525
1535char *opendal_entry_name(const struct opendal_entry *self);
1536
1541
1546 uint8_t *buf,
1547 uintptr_t len);
1548
1553 int64_t offset,
1554 int32_t whence);
1555
1560
1565 const struct opendal_bytes *bytes);
1566
1571
1576
1577#ifdef __cplusplus
1578} // extern "C"
1579#endif // __cplusplus
1580
1581#endif /* _OPENDAL_H */
struct opendal_result_presign opendal_operator_presign_write(const struct opendal_operator *op, const char *path, uint64_t expire_secs)
Presign a write operation.
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.
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 namesp...
void opendal_operator_free(const struct opendal_operator *ptr)
Free the heap-allocated operator pointed by opendal_operator.
struct opendal_result_reader_seek opendal_reader_seek(struct opendal_reader *self, int64_t offset, int32_t whence)
Seek to an offset, in bytes, in a stream.
struct opendal_error * opendal_operator_create_dir(const struct opendal_operator *op, const char *path)
Blocking create the directory in path.
struct opendal_result_presign opendal_operator_presign_stat(const struct opendal_operator *op, const char *path, uint64_t expire_secs)
Presign a stat operation.
struct opendal_result_reader_read opendal_reader_read(struct opendal_reader *self, uint8_t *buf, uintptr_t len)
Read data from the reader.
struct opendal_result_operator_new opendal_operator_new(const char *scheme, const struct opendal_operator_options *options)
Construct an operator based on scheme and options
struct opendal_result_lister_next opendal_lister_next(struct opendal_lister *self)
Return the next object to be listed.
uintptr_t opendal_presigned_request_headers_len(const struct opendal_presigned_request *req)
char * opendal_operator_info_get_scheme(const struct opendal_operator_info *self)
Return the nul-terminated operator's scheme, i.e. service.
void opendal_error_free(struct opendal_error *ptr)
Frees the opendal_error, ok to call on NULL.
void opendal_operator_info_free(struct opendal_operator_info *ptr)
Free the heap-allocated opendal_operator_info.
struct opendal_result_exists opendal_operator_exists(const struct opendal_operator *op, const char *path)
Check whether the path exists.
struct opendal_error * opendal_operator_copy(const struct opendal_operator *op, const char *src, const char *dest)
Blocking copy the object in path.
opendal_code
The error code for all opendal APIs in C binding.
Definition opendal.h:39
@ OPENDAL_CONDITION_NOT_MATCH
Definition opendal.h:83
@ OPENDAL_UNSUPPORTED
Definition opendal.h:47
@ OPENDAL_NOT_FOUND
Definition opendal.h:55
@ OPENDAL_IS_A_DIRECTORY
Definition opendal.h:63
@ OPENDAL_UNEXPECTED
Definition opendal.h:43
@ OPENDAL_PERMISSION_DENIED
Definition opendal.h:59
@ OPENDAL_ALREADY_EXISTS
Definition opendal.h:71
@ OPENDAL_IS_SAME_FILE
Definition opendal.h:79
@ OPENDAL_RANGE_NOT_SATISFIED
Definition opendal.h:87
@ OPENDAL_NOT_A_DIRECTORY
Definition opendal.h:67
@ OPENDAL_RATE_LIMITED
Definition opendal.h:75
@ OPENDAL_CONFIG_INVALID
Definition opendal.h:51
struct opendal_result_writer_write opendal_writer_write(struct opendal_writer *self, const struct opendal_bytes *bytes)
Write data to the writer.
struct opendal_error * opendal_writer_close(struct opendal_writer *ptr)
Close the writer and make sure all data have been stored.
struct opendal_result_presign opendal_operator_presign_delete(const struct opendal_operator *op, const char *path, uint64_t expire_secs)
Presign a delete operation.
void opendal_lister_free(struct opendal_lister *ptr)
Free the heap-allocated metadata used by opendal_lister.
struct opendal_result_presign opendal_operator_presign_read(const struct opendal_operator *op, const char *path, uint64_t expire_secs)
Presign a read operation.
char * opendal_entry_name(const struct opendal_entry *self)
Name of entry.
void opendal_reader_free(struct opendal_reader *ptr)
Frees the heap memory used by the opendal_reader.
void opendal_operator_options_free(struct opendal_operator_options *ptr)
Free the allocated memory used by [opendal_operator_options].
bool opendal_metadata_is_file(const struct opendal_metadata *self)
Return whether the path represents a file.
struct opendal_capability opendal_operator_info_get_native_capability(const struct opendal_operator_info *self)
Return the operator's native capability.
struct opendal_result_stat opendal_operator_stat(const struct opendal_operator *op, const char *path)
Stat the path, return its metadata.
void opendal_metadata_free(struct opendal_metadata *ptr)
Free the heap-allocated metadata used by opendal_metadata.
struct opendal_capability opendal_operator_info_get_full_capability(const struct opendal_operator_info *self)
Return the operator's full capability.
struct opendal_error * opendal_operator_rename(const struct opendal_operator *op, const char *src, const char *dest)
Blocking rename the object in path.
void opendal_presigned_request_free(struct opendal_presigned_request *req)
Free the presigned request.
char * opendal_operator_info_get_root(const struct opendal_operator_info *self)
Return the nul-terminated operator's working root path.
struct opendal_result_read opendal_operator_read(const struct opendal_operator *op, const char *path)
Blocking read the data from path.
void opendal_writer_free(struct opendal_writer *ptr)
Frees the heap memory used by the opendal_writer.
struct opendal_error * opendal_operator_check(const struct opendal_operator *op)
const char * opendal_presigned_request_method(const struct opendal_presigned_request *req)
char * opendal_entry_path(const struct opendal_entry *self)
Path of entry.
const char * opendal_presigned_request_uri(const struct opendal_presigned_request *req)
bool opendal_metadata_is_dir(const struct opendal_metadata *self)
Return whether the path represents a directory.
uint64_t opendal_metadata_content_length(const struct opendal_metadata *self)
Return the content_length of the metadata.
struct opendal_result_operator_reader opendal_operator_reader(const struct opendal_operator *op, const char *path)
Blocking read the data from path.
struct opendal_result_is_exist opendal_operator_is_exist(const struct opendal_operator *op, const char *path)
Check whether the path exists.
const struct opendal_http_header_pair * opendal_presigned_request_headers(const struct opendal_presigned_request *req)
struct opendal_error * opendal_operator_delete(const struct opendal_operator *op, const char *path)
Blocking delete the object in path.
void opendal_bytes_free(struct opendal_bytes *ptr)
Frees the heap memory used by the opendal_bytes.
struct opendal_result_operator_writer opendal_operator_writer(const struct opendal_operator *op, const char *path)
Blocking create a writer for the specified path.
struct opendal_presigned_request_inner opendal_presigned_request_inner
Definition opendal.h:90
void opendal_operator_options_set(struct opendal_operator_options *self, const char *key, const char *value)
Set a Key-Value pair inside opendal_operator_options.
struct opendal_operator_options * opendal_operator_options_new(void)
Construct a heap-allocated opendal_operator_options.
struct opendal_result_list opendal_operator_list(const struct opendal_operator *op, const char *path)
Blocking list the objects in path.
void opendal_entry_free(struct opendal_entry *ptr)
Frees the heap memory used by the opendal_list_entry.
int64_t opendal_metadata_last_modified_ms(const struct opendal_metadata *self)
Return the last_modified of the metadata, in milliseconds.
struct opendal_operator_info * opendal_operator_info_new(const struct opendal_operator *op)
Get information of underlying accessor.
opendal_bytes carries raw-bytes with its length
Definition opendal.h:101
uintptr_t capacity
Definition opendal.h:113
uintptr_t len
Definition opendal.h:109
uint8_t * data
Definition opendal.h:105
Capability is used to describe what operations are supported by current Operator.
Definition opendal.h:445
bool write_can_append
Definition opendal.h:497
bool write_can_multi
Definition opendal.h:489
bool list_with_start_after
Definition opendal.h:561
bool delete_
Definition opendal.h:541
bool create_dir
Definition opendal.h:537
uintptr_t write_multi_min_size
Definition opendal.h:525
bool shared
Definition opendal.h:589
bool stat_with_if_match
Definition opendal.h:453
bool read_with_override_content_type
Definition opendal.h:481
bool presign_stat
Definition opendal.h:577
bool read_with_if_match
Definition opendal.h:465
bool write
Definition opendal.h:485
bool presign_read
Definition opendal.h:573
bool presign_delete
Definition opendal.h:585
bool write_with_content_type
Definition opendal.h:501
uintptr_t write_total_max_size
Definition opendal.h:533
bool presign
Definition opendal.h:569
bool read
Definition opendal.h:461
bool rename
Definition opendal.h:549
bool list
Definition opendal.h:553
bool write_with_cache_control
Definition opendal.h:509
bool stat_with_if_none_match
Definition opendal.h:457
uintptr_t write_multi_max_size
Definition opendal.h:517
bool write_can_empty
Definition opendal.h:493
bool copy
Definition opendal.h:545
bool stat
Definition opendal.h:449
bool read_with_override_content_disposition
Definition opendal.h:477
bool read_with_if_none_match
Definition opendal.h:469
bool list_with_recursive
Definition opendal.h:565
bool write_with_content_disposition
Definition opendal.h:505
bool presign_write
Definition opendal.h:581
bool list_with_limit
Definition opendal.h:557
bool read_with_override_cache_control
Definition opendal.h:473
opendal_list_entry is the entry under a path, which is listed from the opendal_lister
Definition opendal.h:148
void * inner
Definition opendal.h:153
The opendal error type for C binding, containing an error code and corresponding error message.
Definition opendal.h:135
struct opendal_bytes message
Definition opendal.h:137
enum opendal_code code
Definition opendal.h:136
The key-value pair for the headers of the presigned request.
Definition opendal.h:617
const char * key
Definition opendal.h:621
const char * value
Definition opendal.h:625
BlockingLister is designed to list entries at given path in a blocking manner.
Definition opendal.h:183
void * inner
Definition opendal.h:188
Carries all metadata associated with a path.
Definition opendal.h:202
void * inner
Definition opendal.h:207
Metadata for operator, users can use this metadata to get information of operator.
Definition opendal.h:433
void * inner
Definition opendal.h:438
The configuration for the initialization of opendal_operator.
Definition opendal.h:264
void * inner
Definition opendal.h:269
Used to access almost all OpenDAL APIs. It represents an operator that provides the unified interface...
Definition opendal.h:223
void * inner
Definition opendal.h:228
The underlying presigned request, which contains the HTTP method, URI, and headers....
Definition opendal.h:596
struct opendal_presigned_request_inner * inner
Definition opendal.h:597
The result type returned by opendal's reader operation.
Definition opendal.h:297
void * inner
Definition opendal.h:302
The result type returned by opendal_operator_exists().
Definition opendal.h:382
bool exists
Definition opendal.h:386
struct opendal_error * error
Definition opendal.h:390
The result type returned by opendal_operator_is_exist().
Definition opendal.h:361
struct opendal_error * error
Definition opendal.h:369
bool is_exist
Definition opendal.h:365
The result type returned by opendal_operator_list().
Definition opendal.h:418
struct opendal_lister * lister
Definition opendal.h:422
struct opendal_error * error
Definition opendal.h:426
The result type returned by opendal_lister_next(). The list entry is the list result of the list oper...
Definition opendal.h:163
struct opendal_entry * entry
Definition opendal.h:167
struct opendal_error * error
Definition opendal.h:171
The result type returned by opendal_operator_new() operation.
Definition opendal.h:243
struct opendal_operator * op
Definition opendal.h:247
struct opendal_error * error
Definition opendal.h:251
The result type returned by opendal_operator_reader(). The result type for opendal_operator_reader(),...
Definition opendal.h:311
struct opendal_error * error
Definition opendal.h:319
struct opendal_reader * reader
Definition opendal.h:315
The result type returned by opendal_operator_writer(). The result type for opendal_operator_writer(),...
Definition opendal.h:340
struct opendal_writer * writer
Definition opendal.h:344
struct opendal_error * error
Definition opendal.h:348
The result of a presign operation.
Definition opendal.h:603
struct opendal_presigned_request * req
Definition opendal.h:607
struct opendal_error * error
Definition opendal.h:611
The result type returned by opendal's read operation.
Definition opendal.h:280
struct opendal_bytes data
Definition opendal.h:284
struct opendal_error * error
Definition opendal.h:288
The is the result type returned by opendal_reader_read(). The result type contains a size field,...
Definition opendal.h:633
struct opendal_error * error
Definition opendal.h:641
uintptr_t size
Definition opendal.h:637
The result type returned by opendal_reader_seek(). The result type contains a pos field,...
Definition opendal.h:649
struct opendal_error * error
Definition opendal.h:657
uint64_t pos
Definition opendal.h:653
The result type returned by opendal_operator_stat().
Definition opendal.h:400
struct opendal_metadata * meta
Definition opendal.h:404
struct opendal_error * error
Definition opendal.h:408
The result type returned by opendal_writer_write(). The result type contains a size field,...
Definition opendal.h:665
uintptr_t size
Definition opendal.h:669
struct opendal_error * error
Definition opendal.h:673
The result type returned by opendal's writer operation.
Definition opendal.h:327
void * inner
Definition opendal.h:332