From 8d99628f03d0e79441240240cef834f2e2a54bb7 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Tue, 30 Sep 2025 11:24:53 -0400 Subject: [PATCH] remove deprecated moonpool-io and moonpool.sync --- dune-project | 12 --------- moonpool-io.opam | 33 ----------------------- moonpool-lwt.opam | 2 ++ src/io/dune | 7 ----- src/io/moonpool_io.ml | 15 ----------- src/sync/dune | 5 ---- src/sync/event.ml | 11 -------- src/sync/event.mli | 12 --------- src/sync/lock.ml | 38 -------------------------- src/sync/lock.mli | 56 --------------------------------------- src/sync/moonpool_sync.ml | 11 -------- 11 files changed, 2 insertions(+), 200 deletions(-) delete mode 100644 moonpool-io.opam delete mode 100644 src/io/dune delete mode 100644 src/io/moonpool_io.ml delete mode 100644 src/sync/dune delete mode 100644 src/sync/event.ml delete mode 100644 src/sync/event.mli delete mode 100644 src/sync/lock.ml delete mode 100644 src/sync/lock.mli delete mode 100644 src/sync/moonpool_sync.ml diff --git a/dune-project b/dune-project index 2e408072..bf88d190 100644 --- a/dune-project +++ b/dune-project @@ -52,17 +52,5 @@ (trace-tef :with-test) (odoc :with-doc))) -(package - (name moonpool-io) - (synopsis "Async IO for moonpool, relying on picos (experimental)") - (allow_empty) ; on < 5.0 - (depends - (moonpool (= :version)) - (picos_io (and (>= 0.5) (< 0.7))) - (ocaml (>= 5.0)) - (trace :with-test) - (trace-tef :with-test) - (odoc :with-doc))) - ; See the complete stanza docs at https://dune.readthedocs.io/en/stable/dune-files.html#dune-project diff --git a/moonpool-io.opam b/moonpool-io.opam deleted file mode 100644 index e2c3c955..00000000 --- a/moonpool-io.opam +++ /dev/null @@ -1,33 +0,0 @@ -# This file is generated by dune, edit dune-project instead -opam-version: "2.0" -version: "0.9" -synopsis: "Async IO for moonpool, relying on picos (experimental)" -maintainer: ["Simon Cruanes"] -authors: ["Simon Cruanes"] -license: "MIT" -homepage: "https://github.com/c-cube/moonpool" -bug-reports: "https://github.com/c-cube/moonpool/issues" -depends: [ - "dune" {>= "3.0"} - "moonpool" {= version} - "picos_io" {>= "0.5" & < "0.7"} - "ocaml" {>= "5.0"} - "trace" {with-test} - "trace-tef" {with-test} - "odoc" {with-doc} -] -build: [ - ["dune" "subst"] {dev} - [ - "dune" - "build" - "-p" - name - "-j" - jobs - "@install" - "@runtest" {with-test} - "@doc" {with-doc} - ] -] -dev-repo: "git+https://github.com/c-cube/moonpool.git" diff --git a/moonpool-lwt.opam b/moonpool-lwt.opam index 0f79e676..08a93ac3 100644 --- a/moonpool-lwt.opam +++ b/moonpool-lwt.opam @@ -11,6 +11,8 @@ depends: [ "dune" {>= "3.0"} "moonpool" {= version} "ocaml" {>= "5.0"} + "qcheck-core" {with-test & >= "0.19"} + "hmap" {with-test} "lwt" "base-unix" "trace" {with-test} diff --git a/src/io/dune b/src/io/dune deleted file mode 100644 index cc8d0bd9..00000000 --- a/src/io/dune +++ /dev/null @@ -1,7 +0,0 @@ -(library - (name moonpool_io) - (public_name moonpool-io) - (synopsis "Async IO for moonpool, using Picos") - (enabled_if - (>= %{ocaml_version} 5.0)) - (libraries moonpool moonpool.fib picos_io picos_io.select picos_io.fd)) diff --git a/src/io/moonpool_io.ml b/src/io/moonpool_io.ml deleted file mode 100644 index c4a81c90..00000000 --- a/src/io/moonpool_io.ml +++ /dev/null @@ -1,15 +0,0 @@ -[@@@deprecated "just use lwt or eio or something else"] - -module Fd = Picos_io_fd -module Unix = Picos_io.Unix -module Select = Picos_io_select - -let fd_of_unix_fd : Unix.file_descr -> Fd.t = Fun.id - -(** [main f] runs [f()] inside a scheduler. *) -let main (f : Moonpool.Runner.t -> 'a) : 'a = Moonpool_fib.main f - -(** {2 Async read/write} *) - -let read = Unix.read -let write = Unix.write diff --git a/src/sync/dune b/src/sync/dune deleted file mode 100644 index 365d310b..00000000 --- a/src/sync/dune +++ /dev/null @@ -1,5 +0,0 @@ -(library - (name moonpool_sync) - (public_name moonpool.sync) - (synopsis "Cooperative synchronization primitives for Moonpool") - (libraries moonpool picos picos_std.sync picos_std.event)) diff --git a/src/sync/event.ml b/src/sync/event.ml deleted file mode 100644 index 90446648..00000000 --- a/src/sync/event.ml +++ /dev/null @@ -1,11 +0,0 @@ -include Picos_std_event.Event - -let[@inline] of_fut (fut : _ Moonpool.Fut.t) : _ t = - from_computation (Moonpool.Fut.Private_.as_computation fut) - -module Infix = struct - let[@inline] ( let+ ) x f = map f x - let ( >|= ) = ( let+ ) -end - -include Infix diff --git a/src/sync/event.mli b/src/sync/event.mli deleted file mode 100644 index 309edbc7..00000000 --- a/src/sync/event.mli +++ /dev/null @@ -1,12 +0,0 @@ -include module type of struct - include Picos_std_event.Event -end - -val of_fut : 'a Moonpool.Fut.t -> 'a t - -module Infix : sig - val ( >|= ) : 'a t -> ('a -> 'b) -> 'b t - val ( let+ ) : 'a t -> ('a -> 'b) -> 'b t -end - -include module type of Infix diff --git a/src/sync/lock.ml b/src/sync/lock.ml deleted file mode 100644 index fb70e3ac..00000000 --- a/src/sync/lock.ml +++ /dev/null @@ -1,38 +0,0 @@ -module Mutex = Picos_std_sync.Mutex - -type 'a t = { - mutex: Mutex.t; - mutable content: 'a; -} - -let create content : _ t = { mutex = Mutex.create (); content } - -let with_ (self : _ t) f = - Mutex.lock self.mutex; - try - let x = f self.content in - Mutex.unlock self.mutex; - x - with e -> - Mutex.unlock self.mutex; - raise e - -let[@inline] mutex self = self.mutex -let[@inline] update self f = with_ self (fun x -> self.content <- f x) - -let[@inline] update_map l f = - with_ l (fun x -> - let x', y = f x in - l.content <- x'; - y) - -let get l = - Mutex.lock l.mutex; - let x = l.content in - Mutex.unlock l.mutex; - x - -let set l x = - Mutex.lock l.mutex; - l.content <- x; - Mutex.unlock l.mutex diff --git a/src/sync/lock.mli b/src/sync/lock.mli deleted file mode 100644 index 2e8a8994..00000000 --- a/src/sync/lock.mli +++ /dev/null @@ -1,56 +0,0 @@ -(** Mutex-protected resource. - - This lock is a synchronous concurrency primitive, as a thin wrapper around - {!Mutex} that encourages proper management of the critical section in RAII - style: - - {[ - let (let@) = (@@) - - - … - let compute_foo = - (* enter critical section *) - let@ x = Lock.with_ protected_resource in - use_x; - return_foo () - (* exit critical section *) - in - … - ]} - - This lock is based on {!Picos_sync.Mutex} so it is [await]-safe. - - @since 0.7 *) - -type 'a t -(** A value protected by a cooperative mutex *) - -val create : 'a -> 'a t -(** Create a new protected value. *) - -val with_ : 'a t -> ('a -> 'b) -> 'b -(** [with_ l f] runs [f x] where [x] is the value protected with the lock [l], - in a critical section. If [f x] fails, [with_lock l f] fails too but the - lock is released. *) - -val update : 'a t -> ('a -> 'a) -> unit -(** [update l f] replaces the content [x] of [l] with [f x], while protected by - the mutex. *) - -val update_map : 'a t -> ('a -> 'a * 'b) -> 'b -(** [update_map l f] computes [x', y = f (get l)], then puts [x'] in [l] and - returns [y], while protected by the mutex. *) - -val mutex : _ t -> Picos_std_sync.Mutex.t -(** Underlying mutex. *) - -val get : 'a t -> 'a -(** Atomically get the value in the lock. The value that is returned isn't - protected! *) - -val set : 'a t -> 'a -> unit -(** Atomically set the value. - - {b NOTE} caution: using {!get} and {!set} as if this were a {!ref} is an - anti pattern and will not protect data against some race conditions. *) diff --git a/src/sync/moonpool_sync.ml b/src/sync/moonpool_sync.ml deleted file mode 100644 index 88a6972a..00000000 --- a/src/sync/moonpool_sync.ml +++ /dev/null @@ -1,11 +0,0 @@ -[@@@ocaml.deprecated "use Picos_std_sync directly or single threaded solutions"] - -module Mutex = Picos_std_sync.Mutex -module Condition = Picos_std_sync.Condition -module Lock = Lock -module Event = Event -module Semaphore = Picos_std_sync.Semaphore -module Lazy = Picos_std_sync.Lazy -module Latch = Picos_std_sync.Latch -module Ivar = Picos_std_sync.Ivar -module Stream = Picos_std_sync.Stream