Skip to content

Commit

Permalink
Merge pull request #485 from talex5/remove-luv
Browse files Browse the repository at this point in the history
Remove eio_luv backend
  • Loading branch information
talex5 authored Apr 13, 2023
2 parents 72f9d77 + e605f06 commit 1277485
Show file tree
Hide file tree
Showing 22 changed files with 31 additions and 1,914 deletions.
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ bench:
dune exec -- ./bench/bench_cancel.exe
if ocamlc -config | grep -q '^system: linux'; then dune exec -- ./lib_eio_linux/tests/bench_noop.exe; fi

test_luv:
EIO_BACKEND=luv dune runtest

test_posix:
EIO_BACKEND=posix dune runtest

Expand Down
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,9 @@ See [Awesome Multicore OCaml][] for links to work migrating other projects to Ei

- [Eio][] provides concurrency primitives (promises, etc.) and a high-level, cross-platform OS API.
- [Eio_posix][] provides a cross-platform backend for these APIs for POSIX-type systems.
- [Eio_luv][] provides a cross-platform backend for these APIs using [luv](https://github.com/aantron/luv) (libuv).
- [Eio_linux][] provides a Linux io-uring backend for these APIs,
plus a low-level API that can be used directly (in non-portable code).
- [Eio_main][] selects an appropriate backend (e.g. `eio_linux`, `eio_posix` or `eio_luv`), depending on your platform.
- [Eio_main][] selects an appropriate backend (e.g. `eio_linux` or `eio_posix`), depending on your platform.

## Getting OCaml 5.0

Expand Down Expand Up @@ -701,7 +700,7 @@ For example:
let test r =
try Eio.Buf_read.line r
with
| Eio.Io (Eio.Net.E Connection_reset Eio_luv.Luv_error _, _) -> "Luv connection reset"
| Eio.Io (Eio.Net.E Connection_reset Eio_unix.Unix_error _, _) -> "Unix connection reset"
| Eio.Io (Eio.Net.E Connection_reset _, _) -> "Connection reset"
| Eio.Io (Eio.Net.E _, _) -> "Some network error"
| Eio.Io _ -> "Some I/O error"
Expand Down Expand Up @@ -757,11 +756,11 @@ it can be annoying to have the full backend-specific error displayed:
Switch.run @@ fun sw ->
Eio.Net.connect ~sw net (`Tcp (Eio.Net.Ipaddr.V4.loopback, 1234));;
Exception:
Eio.Io Net Connection_failure Refused Eio_luv.Luv_error(ECONNREFUSED) (* connection refused *),
Eio.Io Net Connection_failure Refused Unix_error (Connection refused, "connect", ""),
connecting to tcp:127.0.0.1:1234
```

If we ran this using e.g. the Linux io_uring backend, the `Luv_error` part would change.
If we ran this using another backend, the `Unix_error` part might change.
To avoid this problem, you can use `Eio.Exn.Backend.show` to hide the backend-specific part of errors:

```ocaml
Expand Down Expand Up @@ -887,10 +886,6 @@ A program that operates on the current directory will probably want to use `cwd`
whereas a program that accepts a path from the user will probably want to use `fs`,
perhaps with `open_dir` to constrain all access to be within that directory.

Note: the `eio_luv` backend doesn't have the `openat`, `mkdirat`, etc.,
calls that are necessary to implement these checks without races,
so be careful if symlinks out of the subtree may be created while the program is running.

## Time

The standard environment provides a [clock][Eio.Time] with the usual POSIX time:
Expand Down Expand Up @@ -1732,7 +1727,6 @@ Some background about the effects system can be found in:
[Eio.Promise]: https://ocaml-multicore.github.io/eio/eio/Eio/Promise/index.html
[Eio.Stream]: https://ocaml-multicore.github.io/eio/eio/Eio/Stream/index.html
[Eio_posix]: https://github.com/ocaml-multicore/eio/blob/main/lib_eio_posix/eio_posix.mli
[Eio_luv]: https://ocaml-multicore.github.io/eio/eio_luv/Eio_luv/index.html
[Eio_linux]: https://ocaml-multicore.github.io/eio/eio_linux/Eio_linux/index.html
[Eio_main]: https://ocaml-multicore.github.io/eio/eio_main/Eio_main/index.html
[Eio.traceln]: https://ocaml-multicore.github.io/eio/eio/Eio/index.html#val-traceln
Expand Down
2 changes: 1 addition & 1 deletion doc/rationale.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ For example, there are many ways to provide a stream of bytes (from a file, TCP
Often this choice is determined by the user at runtime, for example by providing a URL giving the scheme to use.
We may even need to choose a completely different Eio backend at runtime.
For example `Eio_main.run` will use the io_uring backend if the Linux kernel is new enough,
but fall back to `Eio_luv` if not.
but fall back to `Eio_posix` if not.
For these reasons, Eio needs to use dynamic dispatch.

A resource whose implementation isn't known until runtime can be represented in many ways, including:
Expand Down
16 changes: 6 additions & 10 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,19 @@
(mdx (and (>= 2.2.0) :with-test))
(fmt (>= 0.8.9))))
(package
(name eio_luv)
(synopsis "Eio implementation using luv (libuv)")
(description "An Eio implementation for most platforms, using luv.")
(name eio_windows)
(synopsis "Eio implementation for Windows")
(description "An Eio implementation using I/O Completion Ports")
(allow_empty) ; Work-around for dune bug #6938
(depends
(eio (= :version))
(luv (>= 0.5.11))
(luv_unix (>= 0.5.0))
(mdx (and (>= 2.2.0) :with-test))
(fmt (>= 0.8.9))))
(eio (= :version))))
(package
(name eio_main)
(synopsis "Effect-based direct-style IO mainloop for OCaml")
(description "Selects an appropriate Eio backend for the current platform.")
(depopts eio_luv)
(depends
(mdx (and (>= 2.2.0) :with-test))
(eio_linux (and (= :version) (= :os "linux")))
(eio_posix (and (= :version) (<> :os "windows")))
(eio_luv (and (= :version) (or (= :os "windows") :with-test)))))
(eio_windows (and (= :version) (= :os "windows")))))
(using mdx 0.2)
3 changes: 1 addition & 2 deletions eio_main.opam
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ depends: [
"mdx" {>= "2.2.0" & with-test}
"eio_linux" {= version & os = "linux"}
"eio_posix" {= version & os != "windows"}
"eio_luv" {= version & os = "windows" | with-test}
"eio_windows" {= version & os = "windows"}
"odoc" {with-doc}
]
depopts: ["eio_luv"]
build: [
["dune" "subst"] {dev}
[
Expand Down
8 changes: 2 additions & 6 deletions eio_luv.opam → eio_windows.opam
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
synopsis: "Eio implementation using luv (libuv)"
description: "An Eio implementation for most platforms, using luv."
synopsis: "Eio implementation for Windows"
description: "An Eio implementation using I/O Completion Ports"
maintainer: ["[email protected]"]
authors: ["Anil Madhavapeddy" "Thomas Leonard"]
license: "ISC"
Expand All @@ -11,10 +11,6 @@ bug-reports: "https://github.com/ocaml-multicore/eio/issues"
depends: [
"dune" {>= "3.7"}
"eio" {= version}
"luv" {>= "0.5.11"}
"luv_unix" {>= "0.5.0"}
"mdx" {>= "2.2.0" & with-test}
"fmt" {>= "0.8.9"}
"odoc" {with-doc}
]
build: [
Expand Down
4 changes: 0 additions & 4 deletions lib_eio_luv/dune

This file was deleted.

Loading

0 comments on commit 1277485

Please sign in to comment.