From 40460417fa9bb448f78adfb0ffcb1bfe3b7e5d37 Mon Sep 17 00:00:00 2001 From: metanivek Date: Wed, 2 Aug 2023 12:06:35 -0400 Subject: [PATCH] Update irmin-server/client API for new `clear` arg --- src/irmin-client/client.ml | 10 ++++++---- src/irmin-server/command.ml | 10 ++++++---- src/irmin-server/command_intf.ml | 6 ++++-- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/irmin-client/client.ml b/src/irmin-client/client.ml index 400f06c0cb..51ff8abee1 100644 --- a/src/irmin-client/client.ml +++ b/src/irmin-client/client.ml @@ -702,16 +702,18 @@ struct let repo = repo store in request repo (module Commands.Store.Find) path >|= Error.unwrap "find" - let remove_exn ?retries ?allow_empty ?parents ~info store path = + let remove_exn ?clear ?retries ?allow_empty ?parents ~info store path = let parents = Option.map (List.map (fun c -> Commit.hash c)) parents in let repo = repo store in request repo (module Commands.Store.Remove) - ((retries, allow_empty, parents), path, info ()) + (((clear, retries), (allow_empty, parents)), path, info ()) >|= Error.unwrap "remove" - let remove ?retries ?allow_empty ?parents ~info store path = - let* x = remove_exn ?retries ?allow_empty ?parents ~info store path in + let remove ?clear ?retries ?allow_empty ?parents ~info store path = + let* x = + remove_exn ?clear ?retries ?allow_empty ?parents ~info store path + in Lwt.return_ok x let find_tree store path = diff --git a/src/irmin-server/command.ml b/src/irmin-server/command.ml index 791328a5b8..d56ca08cc6 100644 --- a/src/irmin-server/command.ml +++ b/src/irmin-server/command.ml @@ -593,7 +593,8 @@ struct Return.v conn res_t (Some x) end - type write_options = int option * bool option * Store.hash list option + type write_options = + (bool option * int option) * (bool option * Store.hash list option) [@@deriving irmin] let mk_parents ctx parents = @@ -613,11 +614,12 @@ struct let name = "store.remove" - let run conn ctx _ ((retries, allow_empty, parents), path, info) = + let run conn ctx _ + (((clear, retries), (allow_empty, parents)), path, info) = let* parents = mk_parents ctx parents in let* () = - Store.remove_exn ?retries ?allow_empty ?parents ctx.store path - ~info:(fun () -> info) + Store.remove_exn ?clear ?retries ?allow_empty ?parents ctx.store + path ~info:(fun () -> info) in Return.v conn res_t () end diff --git a/src/irmin-server/command_intf.ml b/src/irmin-server/command_intf.ml index a5e18e0867..e549056b88 100644 --- a/src/irmin-server/command_intf.ml +++ b/src/irmin-server/command_intf.ml @@ -290,7 +290,8 @@ module type S = sig (* Store *) module Store : sig - type write_options = int option * bool option * Store.hash list option + type write_options = + (bool option * int option) * (bool option * Store.hash list option) [@@deriving irmin] (** Find a value in the store *) @@ -301,7 +302,8 @@ module type S = sig module Remove : CMD with type req = - (int option * bool option * Store.hash list option) + ((bool option * int option) + * (bool option * Store.hash list option)) * Store.path * Store.Info.t and type res = unit