Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adapt to API changes of mirage-conduit (dns resolver now has a timeout) #95

Merged
merged 4 commits into from
May 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ jobs:
command: opam install --deps-only -t -y `basename -s .opam *.opam | tr '\n' ' '`
- run:
name: Test and coverage report
command: opam exec -- make coverage
command: |
coverage_set () [[ -n $COVERALLS_REPO_TOKEN ]]
opam exec -- make test-coverage
(coverage_set && opam exec -- bisect-ppx-report send-to Coveralls) || true


dune_lint:
docker:
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ coverage: clean
test:
@dune runtest --force -p $(PACKAGES)

test-coverage:
@BISECT_ENABLE=yes dune runtest -p $(PACKAGES)

.PHONY: all build clean coverage test
3 changes: 2 additions & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,10 @@
(>= 4.08))
logs
mirage-channel
conduit-mirage
(conduit-mirage (>= 2.2.0))
dns-client
mirage-random
mirage-time
mirage-clock
mirage-stack
(pgx
Expand Down
3 changes: 2 additions & 1 deletion pgx_lwt_mirage.opam
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ depends: [
"ocaml" {>= "4.08"}
"logs"
"mirage-channel"
"conduit-mirage"
"conduit-mirage" {>= "2.2.0"}
"dns-client"
"mirage-random"
"mirage-time"
"mirage-clock"
"mirage-stack"
"pgx" {= version}
Expand Down
2 changes: 1 addition & 1 deletion pgx_lwt_mirage/src/dune
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ let () = Jbuild_plugin.V1.send @@ {|

(library
(public_name pgx_lwt_mirage)
(libraries pgx_lwt lwt logs.lwt pgx mirage-channel conduit-mirage dns-client mirage-random mirage-clock mirage-stack)
(libraries pgx_lwt lwt logs.lwt pgx mirage-channel conduit-mirage dns-client mirage-random mirage-time mirage-clock mirage-stack)
|} ^ preprocess ^ {|)
|}
3 changes: 2 additions & 1 deletion pgx_lwt_mirage/src/pgx_lwt_mirage.ml
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,11 @@ end

module Make
(RANDOM : Mirage_random.S)
(TIME : Mirage_time.S)
(MCLOCK : Mirage_clock.MCLOCK)
(STACK : Mirage_stack.V4) =
struct
module Dns = Dns_client_mirage.Make (RANDOM) (MCLOCK) (STACK)
module Dns = Dns_client_mirage.Make (RANDOM) (TIME) (MCLOCK) (STACK)

type sockaddr = Thread.sockaddr =
| Unix of string
Expand Down
1 change: 1 addition & 0 deletions pgx_lwt_mirage/src/pgx_lwt_mirage.mli
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

module Make
(RANDOM : Mirage_random.S)
(TIME : Mirage_time.S)
(CLOCK : Mirage_clock.MCLOCK)
(STACK : Mirage_stack.V4) : sig
val connect : STACK.t -> (module Pgx_lwt.S)
Expand Down
10 changes: 8 additions & 2 deletions unikernel/config.ml
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,17 @@ let server =
; Key.abstract database
]
~packages
(random @-> pclock @-> mclock @-> stackv4 @-> job)
(random @-> time @-> pclock @-> mclock @-> stackv4 @-> job)
;;

let () =
register
"pgx_unikernel"
[ server $ default_random $ default_posix_clock $ default_monotonic_clock $ stack ]
[ server
$ default_random
$ default_time
$ default_posix_clock
$ default_monotonic_clock
$ stack
]
;;
5 changes: 3 additions & 2 deletions unikernel/unikernel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ open Lwt.Infix

module Make
(RANDOM : Mirage_random.S)
(TIME : Mirage_time.S)
(PCLOCK : Mirage_clock.PCLOCK)
(MCLOCK : Mirage_clock.MCLOCK)
(STACK : Mirage_stack.V4) =
struct
module Pgx_mirage = Pgx_lwt_mirage.Make (RANDOM) (MCLOCK) (STACK)
module Pgx_mirage = Pgx_lwt_mirage.Make (RANDOM) (TIME) (MCLOCK) (STACK)
module Logs_reporter = Mirage_logs.Make (PCLOCK)

type user =
Expand Down Expand Up @@ -58,7 +59,7 @@ struct
users
;;

let start _random _pclock _mclock stack =
let start _random _time _pclock _mclock stack =
Logs.(set_level (Some Info));
Logs_reporter.(create () |> run)
@@ fun () ->
Expand Down