mirror of
https://github.com/c-cube/nanoev.git
synced 2025-12-05 19:00:35 -05:00
wip: ezcurl
This commit is contained in:
parent
fe57c8082e
commit
fc7559db1f
7 changed files with 81 additions and 1 deletions
11
dune-project
11
dune-project
|
|
@ -37,4 +37,15 @@
|
|||
(tiny_httpd (>= 0.17)))
|
||||
(tags (nanoev http)))
|
||||
|
||||
(package
|
||||
(name nanoev_ezcurl)
|
||||
(synopsis "Use nanoev as a basis for ezcurl")
|
||||
(depends
|
||||
ocaml
|
||||
dune
|
||||
nanoev
|
||||
picos
|
||||
(ezcurl (>= 0.2.4)))
|
||||
(tags (nanoev http curl)))
|
||||
|
||||
; See the complete stanza docs at https://dune.readthedocs.io/en/stable/reference/dune-project/index.html
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# This file is generated by dune, edit dune-project instead
|
||||
opam-version: "2.0"
|
||||
synopsis: "Tiny event loop around `select`"
|
||||
synopsis: "Tiny event loop abstraction"
|
||||
maintainer: ["Simon Cruanes"]
|
||||
authors: ["Simon Cruanes"]
|
||||
license: "MIT"
|
||||
|
|
|
|||
32
nanoev_ezcurl.opam
Normal file
32
nanoev_ezcurl.opam
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# This file is generated by dune, edit dune-project instead
|
||||
opam-version: "2.0"
|
||||
synopsis: "Use nanoev as a basis for ezcurl"
|
||||
maintainer: ["Simon Cruanes"]
|
||||
authors: ["Simon Cruanes"]
|
||||
license: "MIT"
|
||||
tags: ["nanoev" "http" "curl"]
|
||||
homepage: "https://github.com/c-cube/nanoev"
|
||||
bug-reports: "https://github.com/c-cube/nanoev/issues"
|
||||
depends: [
|
||||
"ocaml"
|
||||
"dune" {>= "2.7"}
|
||||
"nanoev"
|
||||
"picos"
|
||||
"ezcurl" {>= "0.2.4"}
|
||||
"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/nanoev.git"
|
||||
|
|
@ -4,6 +4,7 @@ synopsis: "Use nanoev as a basis for tiny_httpd"
|
|||
maintainer: ["Simon Cruanes"]
|
||||
authors: ["Simon Cruanes"]
|
||||
license: "MIT"
|
||||
tags: ["nanoev" "http"]
|
||||
homepage: "https://github.com/c-cube/nanoev"
|
||||
bug-reports: "https://github.com/c-cube/nanoev/issues"
|
||||
depends: [
|
||||
|
|
|
|||
9
src/ezcurl/dune
Normal file
9
src/ezcurl/dune
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
(library
|
||||
(name nanoev_ezcurl)
|
||||
(public_name nanoev_ezcurl)
|
||||
(libraries
|
||||
threads
|
||||
picos
|
||||
(re_export nanoev)
|
||||
nanoev.picos
|
||||
(re_export ezcurl)))
|
||||
22
src/ezcurl/nanoev_ezcurl.ml
Normal file
22
src/ezcurl/nanoev_ezcurl.ml
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
module EV = Nanoev_picos
|
||||
include Ezcurl_core
|
||||
|
||||
open struct
|
||||
(* TODO: have a thread-local multi handle? *)
|
||||
let multi : Curl.Multi.mt option Atomic.t = Atomic.make None
|
||||
let lock = Mutex.create ()
|
||||
|
||||
let get_mt () =
|
||||
match Atomic.get multi with
|
||||
| Some mt -> mt
|
||||
end
|
||||
|
||||
include Ezcurl_core.Make (struct
|
||||
type 'a t = 'a
|
||||
|
||||
let[@inline] return x = x
|
||||
let fail = raise
|
||||
let ( >>= ) = ( |> )
|
||||
let ( >|= ) = ( |> )
|
||||
let perform (client : Curl.t) : Curl.curlCode = Curl.Multi.p
|
||||
end)
|
||||
5
src/ezcurl/nanoev_ezcurl.mli
Normal file
5
src/ezcurl/nanoev_ezcurl.mli
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
include module type of struct
|
||||
include Ezcurl_core
|
||||
end
|
||||
|
||||
include Ezcurl_core.S with type 'a io := 'a
|
||||
Loading…
Add table
Reference in a new issue