You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "Xuanwo (via GitHub)" <gi...@apache.org> on 2023/05/26 08:56:00 UTC

[GitHub] [incubator-opendal] Xuanwo commented on a diff in pull request #2329: feat(bindings/C): opendal_operator_ptr construction using kvs

Xuanwo commented on code in PR #2329:
URL: https://github.com/apache/incubator-opendal/pull/2329#discussion_r1206452889


##########
bindings/c/include/opendal.h:
##########
@@ -192,17 +199,37 @@ extern "C" {
 #endif // __cplusplus
 
 /*
- Returns a result type [`opendal_result_op`], with operator_ptr. If the construction succeeds
- the error is nullptr, otherwise it contains the error information.
+ Uses an array of key-value pairs to initialize the operator based on provided scheme.
+
+ # Example
+
+ Following is a C example.

Review Comment:
   I think we don't need this in a `.h` file?



##########
bindings/c/include/opendal.h:
##########
@@ -192,17 +199,37 @@ extern "C" {
 #endif // __cplusplus
 
 /*
- Returns a result type [`opendal_result_op`], with operator_ptr. If the construction succeeds
- the error is nullptr, otherwise it contains the error information.
+ Uses an array of key-value pairs to initialize the operator based on provided scheme.
+
+ # Example
+
+ Following is a C example.
+ ```no_run
+ opendal_operator_options options = opendal_operator_options_new();
+ opendal_operator_options_set(&options, "root", "/myroot");
+
+ opendal_operator_ptr ptr = opendal_operator_from_kvs("memory", options);

Review Comment:
   Should be `opendal_operator_new`?



##########
bindings/c/src/types.rs:
##########
@@ -178,3 +180,63 @@ impl opendal_metadata {
         }
     }
 }
+
+/// [`opendal_operator_options`] represents a series of string type key-value pairs, it may be used for initialization
+#[repr(transparent)]
+pub struct opendal_operator_options {
+    pub inner: *mut HashMap<String, String>,

Review Comment:
   Is this `pub` required?



-- 
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-unsubscribe@opendal.apache.org

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