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
83
93typedef struct opendal_bytes {
97 uint8_t *data;
101 uintptr_t len;
105 uintptr_t capacity;
107
131
140typedef struct opendal_entry {
145 void *inner;
147
165
182
201
222
245
263
282
296
313
326
342
363
384
402
420
432
583
599
615
616#ifdef __cplusplus
617extern "C" {
618#endif // __cplusplus
619
624
635
640
645
660
675
695
710
729
770 const struct opendal_operator_options *options);
771
819 const char *path,
820 const struct opendal_bytes *bytes);
821
864 const char *path);
865
905 const char *path);
906
946 const char *path);
947
990struct opendal_error *opendal_operator_delete(const struct opendal_operator *op, const char *path);
991
1031__attribute__((deprecated("Use opendal_operator_exists() instead.")))
1032struct opendal_result_is_exist opendal_operator_is_exist(const struct opendal_operator *op,
1033 const char *path);
1034
1075 const char *path);
1076
1116 const char *path);
1117
1169 const char *path);
1170
1207 const char *path);
1208
1253 const char *src,
1254 const char *dest);
1255
1300 const char *src,
1301 const char *dest);
1302
1322
1327
1334
1341
1349
1354
1359
1364
1374
1395 const char *key,
1396 const char *value);
1397
1402
1410char *opendal_entry_path(const struct opendal_entry *self);
1411
1421char *opendal_entry_name(const struct opendal_entry *self);
1422
1427
1432 uint8_t *buf,
1433 uintptr_t len);
1434
1439
1444 const struct opendal_bytes *bytes);
1445
1451
1452#ifdef __cplusplus
1453} // extern "C"
1454#endif // __cplusplus
1455
1456#endif /* _OPENDAL_H */
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_error * opendal_operator_create_dir(const struct opendal_operator *op, const char *path)
Blocking create the directory in path.
struct opendal_result_reader_read opendal_reader_read(struct opendal_reader *self, uint8_t *buf, uintptr_t len)
Read data from the reader.
const char * path
Definition opendal.h:1033
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.
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:33
@ OPENDAL_CONDITION_NOT_MATCH
Definition opendal.h:77
@ OPENDAL_UNSUPPORTED
Definition opendal.h:41
@ OPENDAL_NOT_FOUND
Definition opendal.h:49
@ OPENDAL_IS_A_DIRECTORY
Definition opendal.h:57
@ OPENDAL_UNEXPECTED
Definition opendal.h:37
@ OPENDAL_PERMISSION_DENIED
Definition opendal.h:53
@ OPENDAL_ALREADY_EXISTS
Definition opendal.h:65
@ OPENDAL_IS_SAME_FILE
Definition opendal.h:73
@ OPENDAL_RANGE_NOT_SATISFIED
Definition opendal.h:81
@ OPENDAL_NOT_A_DIRECTORY
Definition opendal.h:61
@ OPENDAL_RATE_LIMITED
Definition opendal.h:69
@ OPENDAL_CONFIG_INVALID
Definition opendal.h:45
struct opendal_result_writer_write opendal_writer_write(struct opendal_writer *self, const struct opendal_bytes *bytes)
Write data to the writer.
void opendal_lister_free(struct opendal_lister *ptr)
Free the heap-allocated metadata used by opendal_lister.
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.
__attribute__((deprecated("Use opendal_operator_exists() instead."))) struct opendal_result_is_exist opendal_operator_is_exist(const struct opendal_operator *op
Check whether the path exists.
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.
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.
char * opendal_entry_path(const struct opendal_entry *self)
Path of entry.
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_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.
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:93
uintptr_t capacity
Definition opendal.h:105
uintptr_t len
Definition opendal.h:101
uint8_t * data
Definition opendal.h:97
Capability is used to describe what operations are supported by current Operator.
Definition opendal.h:437
bool write_can_append
Definition opendal.h:489
bool write_can_multi
Definition opendal.h:481
bool list_with_start_after
Definition opendal.h:553
bool delete_
Definition opendal.h:533
bool create_dir
Definition opendal.h:529
bool blocking
Definition opendal.h:581
uintptr_t write_multi_min_size
Definition opendal.h:517
bool shared
Definition opendal.h:577
bool stat_with_if_match
Definition opendal.h:445
bool read_with_override_content_type
Definition opendal.h:473
bool presign_stat
Definition opendal.h:569
bool read_with_if_match
Definition opendal.h:457
bool write
Definition opendal.h:477
bool presign_read
Definition opendal.h:565
bool write_with_content_type
Definition opendal.h:493
uintptr_t write_total_max_size
Definition opendal.h:525
bool presign
Definition opendal.h:561
bool read
Definition opendal.h:453
bool rename
Definition opendal.h:541
bool list
Definition opendal.h:545
bool write_with_cache_control
Definition opendal.h:501
bool stat_with_if_none_match
Definition opendal.h:449
uintptr_t write_multi_max_size
Definition opendal.h:509
bool write_can_empty
Definition opendal.h:485
bool copy
Definition opendal.h:537
bool stat
Definition opendal.h:441
bool read_with_override_content_disposition
Definition opendal.h:469
bool read_with_if_none_match
Definition opendal.h:461
bool list_with_recursive
Definition opendal.h:557
bool write_with_content_disposition
Definition opendal.h:497
bool presign_write
Definition opendal.h:573
bool list_with_limit
Definition opendal.h:549
bool read_with_override_cache_control
Definition opendal.h:465
opendal_list_entry is the entry under a path, which is listed from the opendal_lister
Definition opendal.h:140
void * inner
Definition opendal.h:145
The opendal error type for C binding, containing an error code and corresponding error message.
Definition opendal.h:127
struct opendal_bytes message
Definition opendal.h:129
enum opendal_code code
Definition opendal.h:128
BlockingLister is designed to list entries at given path in a blocking manner.
Definition opendal.h:175
void * inner
Definition opendal.h:180
Carries all metadata associated with a path.
Definition opendal.h:194
void * inner
Definition opendal.h:199
Metadata for operator, users can use this metadata to get information of operator.
Definition opendal.h:425
void * inner
Definition opendal.h:430
The configuration for the initialization of opendal_operator.
Definition opendal.h:256
void * inner
Definition opendal.h:261
Used to access almost all OpenDAL APIs. It represents an operator that provides the unified interface...
Definition opendal.h:215
void * inner
Definition opendal.h:220
The result type returned by opendal's reader operation.
Definition opendal.h:289
void * inner
Definition opendal.h:294
The result type returned by opendal_operator_exists().
Definition opendal.h:374
bool exists
Definition opendal.h:378
struct opendal_error * error
Definition opendal.h:382
The result type returned by opendal_operator_is_exist().
Definition opendal.h:353
struct opendal_error * error
Definition opendal.h:361
bool is_exist
Definition opendal.h:357
The result type returned by opendal_operator_list().
Definition opendal.h:410
struct opendal_lister * lister
Definition opendal.h:414
struct opendal_error * error
Definition opendal.h:418
The result type returned by opendal_lister_next(). The list entry is the list result of the list oper...
Definition opendal.h:155
struct opendal_entry * entry
Definition opendal.h:159
struct opendal_error * error
Definition opendal.h:163
The result type returned by opendal_operator_new() operation.
Definition opendal.h:235
struct opendal_operator * op
Definition opendal.h:239
struct opendal_error * error
Definition opendal.h:243
The result type returned by opendal_operator_reader(). The result type for opendal_operator_reader(),...
Definition opendal.h:303
struct opendal_error * error
Definition opendal.h:311
struct opendal_reader * reader
Definition opendal.h:307
The result type returned by opendal_operator_writer(). The result type for opendal_operator_writer(),...
Definition opendal.h:332
struct opendal_writer * writer
Definition opendal.h:336
struct opendal_error * error
Definition opendal.h:340
The result type returned by opendal's read operation.
Definition opendal.h:272
struct opendal_bytes data
Definition opendal.h:276
struct opendal_error * error
Definition opendal.h:280
The is the result type returned by opendal_reader_read(). The result type contains a size field,...
Definition opendal.h:589
struct opendal_error * error
Definition opendal.h:597
uintptr_t size
Definition opendal.h:593
The result type returned by opendal_operator_stat().
Definition opendal.h:392
struct opendal_metadata * meta
Definition opendal.h:396
struct opendal_error * error
Definition opendal.h:400
The result type returned by opendal_writer_write(). The result type contains a size field,...
Definition opendal.h:605
uintptr_t size
Definition opendal.h:609
struct opendal_error * error
Definition opendal.h:613
The result type returned by opendal's writer operation.
Definition opendal.h:319
void * inner
Definition opendal.h:324