Skip to content

Commit

Permalink
chore: fix Bindings OCaml CI (#5386)
Browse files Browse the repository at this point in the history
  • Loading branch information
meteorgan authored Dec 4, 2024
1 parent d9807d1 commit ec1c53a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 34 deletions.
68 changes: 35 additions & 33 deletions bindings/ocaml/lib/operator.mli
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ val new_operator :
string ->
(string * string) list ->
(Opendal_core.Operator.operator, string) result
(** [new_operator scheme config_map] Create a new block operator from given scheme and config_map.
(** [new_operator scheme config_map] Create a new block operator from given
scheme and config_map.
@param scheme Supported services, for details, refer to https://opendal.apache.org/docs/category/services/
@param scheme
Supported services, for details, refer to
https://opendal.apache.org/docs/category/services/
@param config_map Configuration information required by the target service
@return The block operator
*)
@return The block operator *)

val list :
Opendal_core.Operator.operator ->
Expand All @@ -37,47 +39,45 @@ val stat :
Opendal_core.Operator.operator ->
string ->
(Opendal_core.Operator.metadata, string) result
(** [is_exist operator path] Get current path's metadata **without cache** directly.
(** [is_exist operator path] Get current path's metadata **without cache**
directly.
@param operator The operator
@param path want to stat
@return metadata
*)
@return metadata *)

val is_exist : Opendal_core.Operator.operator -> string -> (bool, string) result
(** [is_exist operator path] Check if this path exists or not.
@param operator The operator
@param path want to check
@return is exists
*)
@return is exists *)

val create_dir :
Opendal_core.Operator.operator -> string -> (bool, string) result
(** [create_dir operator path] Create a dir at given path.
# Notes
To indicate that a path is a directory, it is compulsory to include
a trailing / in the path. Failure to do so may result in
`NotADirectory` error being returned by OpenDAL.
To indicate that a path is a directory, it is compulsory to include a
trailing / in the path. Failure to do so may result in `NotADirectory` error
being returned by OpenDAL.
# Behavior
- Create on existing dir will succeed.
- Create dir is always recursive, works like `mkdir -p`
@param operator The operator
@param path want to create dir
*)
@param path want to create dir *)

val read :
Opendal_core.Operator.operator -> string -> (char array, string) result
(** [read operator path] Read the whole path into a bytes.
@param operator The operator
@param path want to read
@return data of path
*)
@return data of path *)

val reader :
Opendal_core.Operator.operator ->
Expand All @@ -87,63 +87,65 @@ val reader :
@param operator The operator
@param path want to read
@return reader
*)
@return reader *)

val write :
Opendal_core.Operator.operator -> string -> bytes -> (unit, string) result
(** [write operator path data] Write bytes into given path.
- Write will make sure all bytes has been written, or an error will be returned.
- Write will make sure all bytes has been written, or an error will be
returned.
@param operator The operator
@param path want to write
@param data want to write
*)
@param data want to write *)

val copy :
Opendal_core.Operator.operator -> string -> string -> (unit, string) result
(** [copy operator from to] Copy a file from [from] to [to].
- [from] and [to] must be a file.
- [to] will be overwritten if it exists.
- If [from] and [to] are the same, nothing will happen.
- copy is idempotent. For same [from] and [to] input, the result will be the same.
- copy is idempotent. For same [from] and [to] input, the result will be the
same.
@param operator The operator
@param from file path
@param to file path
*)
@param to file path *)

val rename :
Opendal_core.Operator.operator -> string -> string -> (unit, string) result
(** [rename operator from to] Rename a file from [from] to [to].
- [from] and [to] must be a file.
- [to] will be overwritten if it exists.
- If [from] and [to] are the same, a `IsSameFile` error will occur.
@param operator The operator
@param from file path
@param to file path
*)
@param to file path *)

val delete : Opendal_core.Operator.operator -> string -> (unit, string) result
(** [delete operator path] Delete given path.
- Delete not existing error won't return errors.
@param operator The block operator
@param path file path
*)
@param path file path *)

val remove :
Opendal_core.Operator.operator -> string array -> (unit, string) result
(** [remove operator paths] Remove path array.
- We don't support batch delete now, will call delete on each object in turn
@param operator The block operator
@param paths file path array
*)
@param paths file path array *)

val remove_all :
Opendal_core.Operator.operator -> string -> (unit, string) result
(** [remove_all operator path] Remove the path and all nested dirs and files recursively.
(** [remove_all operator path] Remove the path and all nested dirs and files
recursively.
- We don't support batch delete now, will call delete on each object in turn
@param operator The block operator
@param path file path
*)
@param path file path *)

module Reader : sig
val pread :
Expand Down
2 changes: 1 addition & 1 deletion bindings/ocaml/src/operator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub fn blocking_stat(
#[ocaml::func]
#[ocaml::sig("operator -> string -> (bool, string) Result.t ")]
pub fn blocking_is_exist(operator: &mut Operator, path: String) -> Result<bool, String> {
map_res_error(operator.0.is_exist(path.as_str()))
map_res_error(operator.0.exists(path.as_str()))
}

#[ocaml::func]
Expand Down

0 comments on commit ec1c53a

Please sign in to comment.