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

[GitHub] [incubator-opendal] Ranxy opened a new pull request, #2881: feat(binding/ocaml): Add support for operator reader and metadata

Ranxy opened a new pull request, #2881:
URL: https://github.com/apache/incubator-opendal/pull/2881

   Added reader and stat methods of blocking operator


-- 
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


[GitHub] [incubator-opendal] Ranxy commented on a diff in pull request #2881: feat(binding/ocaml): Add support for operator reader and metadata

Posted by "Ranxy (via GitHub)" <gi...@apache.org>.
Ranxy commented on code in PR #2881:
URL: https://github.com/apache/incubator-opendal/pull/2881#discussion_r1299335368


##########
bindings/ocaml/lib/operator.ml:
##########
@@ -18,12 +18,30 @@
 *)
 
 let new_operator = Opendal_core.Operator.operator
+let stat = Opendal_core.Operator.stat
 let is_exist = Opendal_core.Operator.blocking_is_exist
 let create_dir = Opendal_core.Operator.blocking_create_dir
 let read = Opendal_core.Operator.blocking_read
+let reader = Opendal_core.Operator.blocking_reader

Review Comment:
   If all the blocking prefixes are removed, some method names may be `write` and `read`, which will cause an abnormal error in FFI, maybe we should still rename them in the generated code



-- 
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


[GitHub] [incubator-opendal] Ranxy commented on a diff in pull request #2881: feat(binding/ocaml): Add support for operator reader and metadata

Posted by "Ranxy (via GitHub)" <gi...@apache.org>.
Ranxy commented on code in PR #2881:
URL: https://github.com/apache/incubator-opendal/pull/2881#discussion_r1299332301


##########
bindings/ocaml/lib/opendal.ml:
##########
@@ -18,5 +18,6 @@
 *)
 
 module Operator = Operator
+module Seek_from = Opendal_core.Seek_from

Review Comment:
   Yes, we can use `seek_command` from `Unix` package instead of `seek_from`



-- 
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


[GitHub] [incubator-opendal] Ranxy commented on a diff in pull request #2881: feat(binding/ocaml): Add support for operator reader and metadata

Posted by "Ranxy (via GitHub)" <gi...@apache.org>.
Ranxy commented on code in PR #2881:
URL: https://github.com/apache/incubator-opendal/pull/2881#discussion_r1299332301


##########
bindings/ocaml/lib/opendal.ml:
##########
@@ -18,5 +18,6 @@
 *)
 
 module Operator = Operator
+module Seek_from = Opendal_core.Seek_from

Review Comment:
   Yes, we can use `seek_command` from `Unix` package instead of `seek_from`, But there seems to be something wrong with the conversion, I'm trying to solve



-- 
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


[GitHub] [incubator-opendal] Xuanwo commented on a diff in pull request #2881: feat(binding/ocaml): Add support for operator reader and metadata

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #2881:
URL: https://github.com/apache/incubator-opendal/pull/2881#discussion_r1299337794


##########
bindings/ocaml/lib/opendal.ml:
##########
@@ -18,5 +18,6 @@
 *)
 
 module Operator = Operator
+module Seek_from = Opendal_core.Seek_from

Review Comment:
   Thanks a lot! I prefer to integrate with ocaml's native as close as possible.



##########
bindings/ocaml/lib/opendal.ml:
##########
@@ -18,5 +18,6 @@
 *)
 
 module Operator = Operator
+module Seek_from = Opendal_core.Seek_from

Review Comment:
   Thanks a lot! I prefer to integrate with ocaml's native API as close as possible.



-- 
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


[GitHub] [incubator-opendal] Xuanwo commented on a diff in pull request #2881: feat(binding/ocaml): Add support for operator reader and metadata

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #2881:
URL: https://github.com/apache/incubator-opendal/pull/2881#discussion_r1299337929


##########
bindings/ocaml/lib/operator.ml:
##########
@@ -18,12 +18,30 @@
 *)
 
 let new_operator = Opendal_core.Operator.operator
+let stat = Opendal_core.Operator.stat
 let is_exist = Opendal_core.Operator.blocking_is_exist
 let create_dir = Opendal_core.Operator.blocking_create_dir
 let read = Opendal_core.Operator.blocking_read
+let reader = Opendal_core.Operator.blocking_reader

Review Comment:
   > Wouldn't it look weird if we kept the `blocking_` prefix only for these two special functions?
   
   Yes, it looks weird.



-- 
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


[GitHub] [incubator-opendal] Ranxy commented on a diff in pull request #2881: feat(binding/ocaml): Add support for operator reader and metadata

Posted by "Ranxy (via GitHub)" <gi...@apache.org>.
Ranxy commented on code in PR #2881:
URL: https://github.com/apache/incubator-opendal/pull/2881#discussion_r1299348476


##########
bindings/ocaml/lib/operator.ml:
##########
@@ -18,12 +18,30 @@
 *)
 
 let new_operator = Opendal_core.Operator.operator
+let stat = Opendal_core.Operator.stat
 let is_exist = Opendal_core.Operator.blocking_is_exist
 let create_dir = Opendal_core.Operator.blocking_create_dir
 let read = Opendal_core.Operator.blocking_read
+let reader = Opendal_core.Operator.blocking_reader

Review Comment:
   Maybe we don't need to change the `blocking_` prefix, because this only exists in the internal module of `Opendal_core`, and users will only use the methods in the `Operator` module, these methods do not have the `blocking_` prefix.



-- 
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


[GitHub] [incubator-opendal] Ranxy commented on a diff in pull request #2881: feat(binding/ocaml): Add support for operator reader and metadata

Posted by "Ranxy (via GitHub)" <gi...@apache.org>.
Ranxy commented on code in PR #2881:
URL: https://github.com/apache/incubator-opendal/pull/2881#discussion_r1299335368


##########
bindings/ocaml/lib/operator.ml:
##########
@@ -18,12 +18,30 @@
 *)
 
 let new_operator = Opendal_core.Operator.operator
+let stat = Opendal_core.Operator.stat
 let is_exist = Opendal_core.Operator.blocking_is_exist
 let create_dir = Opendal_core.Operator.blocking_create_dir
 let read = Opendal_core.Operator.blocking_read
+let reader = Opendal_core.Operator.blocking_reader

Review Comment:
   If all the blocking prefixes are removed, some method names may be `write` and `read`, which will cause an abnormal error in FFI, maybe we should still rename them in the generated code.
   Wouldn't it look weird if we kept the `blocking_` prefix only for these two special functions?



-- 
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


[GitHub] [incubator-opendal] Ranxy commented on a diff in pull request #2881: feat(binding/ocaml): Add support for operator reader and metadata

Posted by "Ranxy (via GitHub)" <gi...@apache.org>.
Ranxy commented on code in PR #2881:
URL: https://github.com/apache/incubator-opendal/pull/2881#discussion_r1299348025


##########
bindings/ocaml/lib/opendal.ml:
##########
@@ -18,5 +18,6 @@
 *)
 
 module Operator = Operator
+module Seek_from = Opendal_core.Seek_from

Review Comment:
   the OCaml seek API looks like `val lseek : file_descr -> (pos:int) -> seek_command -> int`, we can't use it directly because it is bound to fd. If we design the seek API to be similar to OCaml, it will be `operator -> int -> Unix.seek_command -> (int,string) result`. At the same time, we still need `seek_from `This middle layer handles the calls of rust and ocaml functions



-- 
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


[GitHub] [incubator-opendal] Xuanwo commented on a diff in pull request #2881: feat(binding/ocaml): Add support for operator reader and metadata

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #2881:
URL: https://github.com/apache/incubator-opendal/pull/2881#discussion_r1299330758


##########
bindings/ocaml/lib/opendal.ml:
##########
@@ -18,5 +18,6 @@
 *)
 
 module Operator = Operator
+module Seek_from = Opendal_core.Seek_from

Review Comment:
   Hi, does ocaml have native `Reader`, `IO` or `SeekFrom` concepts? How will ocaml's std lib handles File? On the other side, if a lib want to do read on a file, how will they call it?



##########
bindings/ocaml/lib/operator.ml:
##########
@@ -18,12 +18,30 @@
 *)
 
 let new_operator = Opendal_core.Operator.operator
+let stat = Opendal_core.Operator.stat
 let is_exist = Opendal_core.Operator.blocking_is_exist
 let create_dir = Opendal_core.Operator.blocking_create_dir
 let read = Opendal_core.Operator.blocking_read
+let reader = Opendal_core.Operator.blocking_reader

Review Comment:
   Since it could be a very long time before we add async support for ocaml binding. How about removing all `blocking_` prefix?



-- 
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


[GitHub] [incubator-opendal] Ranxy commented on a diff in pull request #2881: feat(binding/ocaml): Add support for operator reader and metadata

Posted by "Ranxy (via GitHub)" <gi...@apache.org>.
Ranxy commented on code in PR #2881:
URL: https://github.com/apache/incubator-opendal/pull/2881#discussion_r1299332347


##########
bindings/ocaml/lib/operator.ml:
##########
@@ -18,12 +18,30 @@
 *)
 
 let new_operator = Opendal_core.Operator.operator
+let stat = Opendal_core.Operator.stat
 let is_exist = Opendal_core.Operator.blocking_is_exist
 let create_dir = Opendal_core.Operator.blocking_create_dir
 let read = Opendal_core.Operator.blocking_read
+let reader = Opendal_core.Operator.blocking_reader

Review Comment:
   good idea



-- 
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


[GitHub] [incubator-opendal] Xuanwo merged pull request #2881: feat(binding/ocaml): Add support for operator reader and metadata

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo merged PR #2881:
URL: https://github.com/apache/incubator-opendal/pull/2881


-- 
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