Ji-Xinyou commented on code in PR #1861:
URL: 
https://github.com/apache/incubator-opendal/pull/1861#discussion_r1159898725


##########
bindings/c/include/opendal.h:
##########
@@ -25,15 +25,69 @@
 #include <stddef.h>
 #include <stdbool.h>
 
+/*
+ The [`OperatorPtr`] owns a pointer to a [`BlockingOperator`].
+ It is also the key struct that OpenDAL's APIs access the real
+ operator's memory. The use of OperatorPtr is zero cost, it
+ only returns a reference of the underlying Operator.
+ */
+typedef struct opendal_operator_ptr {
+  const void *ptr;
+} opendal_operator_ptr;
+
+/*
+ The [`Vector`] type is a C-compatable substitute for [`Vec`]
+ in Rust, it will not be deallocated automatically like what
+ has been done in Rust. Instead, you have to call [`free_vec`]
+ to free the heap memory to avoid memory leak.
+ The field `data` should not be modified since it might causes
+ the reallocation of the Vector.
+ */
+typedef struct opendal_vector {
+  const uint8_t *data;
+  uintptr_t len;
+} opendal_vector;
+
 #ifdef __cplusplus
 extern "C" {
 #endif // __cplusplus
 
+/*
+ Constructs a new [`OperatorPtr`] which contains a underlying 
[`BlockingOperator`]
+ If the scheme is invalid, or the operator contructions failed, a nullptr is 
returned
+ */
+struct opendal_operator_ptr od_new_operator(const char *scheme);
+
+/*
+ Write the data into the path blockingly by operator, returns whether the 
write succeeds
+ */
+bool od_operator_blocking_write(struct opendal_operator_ptr op_ptr,

Review Comment:
   I have added the `Result` and `Error` type, it is relatively a big PR now....



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@opendal.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to