feat: add moonpool-io

This commit is contained in:
Simon Cruanes 2024-09-03 09:54:08 -04:00
parent a13144810e
commit d16ae869a2
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
4 changed files with 62 additions and 0 deletions

View file

@ -50,4 +50,17 @@
(trace-tef :with-test)
(odoc :with-doc)))
(package
(name moonpool-io)
(synopsis "Async IO for moonpool, relying on picos")
(allow_empty) ; on < 5.0
(depends
(moonpool (= :version))
picos_stdio
(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

33
moonpool-io.opam Normal file
View file

@ -0,0 +1,33 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "0.6"
synopsis: "Async IO for moonpool, relying on picos"
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_stdio"
"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"

5
src/io/dune Normal file
View file

@ -0,0 +1,5 @@
(library
(name moonpool_io)
(public_name moonpool-io)
(synopsis "Async IO for moonpool, using Picos")
(libraries moonpool picos_stdio picos_stdio.select picos_stdio.fd))

11
src/io/moonpool_io.ml Normal file
View file

@ -0,0 +1,11 @@
module Fd = Picos_stdio_fd
module Unix = Picos_stdio.Unix
module Select = Picos_stdio_select
let fd_of_unix_fd : Unix.file_descr -> Fd.t = Fun.id
let configure = Select.configure
(** {2 Async read/write} *)
let read = Unix.read
let write = Unix.write