Skip to content

Commit

Permalink
Merge pull request #2 from hannesm/easy
Browse files Browse the repository at this point in the history
adapt to mirage-kv 3.0.0 API
  • Loading branch information
hannesm authored Oct 30, 2019
2 parents f6db534 + 91652fd commit 883bd6b
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 22 deletions.
9 changes: 5 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ services:
sudo: false
env:
global:
- PRE_INSTALL_HOOK="cd /home/opam/opam-repository && git pull origin master && opam update -u -y"
- PACKAGE="mirage-kv-unix"
- TESTS="true"
- DISTRO=alpine
matrix:
- DISTRO=alpine OCAML_VERSION=4.05
- DISTRO=alpine OCAML_VERSION=4.06
- DISTRO=alpine OCAML_VERSION=4.07
- OCAML_VERSION=4.06
- OCAML_VERSION=4.07
- OCAML_VERSION=4.08
- OCAML_VERSION=4.09
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

This is a Mirage key-value store backed by an underlying Unix directory.

The current version supports the `Mirage_kv.S` and `Mirage_kv_lwt.S` signatures
defined in the `mirage-kv` package.
The current version supports the `Mirage_kv.RO` and `Mirage_kv_lwt.RW`
signatures defined in the `[mirage-kv-lwt](https://github.com/mirage/mirage-kv)`
package.

* WWW: <https://mirage.io>
* E-mail: <mirageos-devel@lists.xenproject.org>
12 changes: 6 additions & 6 deletions mirage-kv-unix.opam
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ build: [

depends: [
"dune" {>= "1.0"}
"ocaml" {>= "4.05.0"}
"cstruct" {>= "3.2.0"}
"mirage-kv-lwt" {>= "1.0.0"}
"ocaml" {>= "4.06.0"}
"mirage-kv" {>= "3.0.0"}
"lwt"
"ptime"
"cstruct" {with-test & >= "3.2.0"}
"rresult" {with-test}
"mirage-clock-unix" {with-test & >= "2.0.0"}
"mirage-clock-unix" {with-test & >= "3.0.0"}
"alcotest" {with-test & >= "0.7.1"}
]
synopsis: "Key-value store for MirageOS backed by Unix filesystem"
description: """
This is a Mirage key-value store backed by an underlying Unix directory.

The current version supports the `Mirage_kv.S` and `Mirage_kv_lwt.S` signatures
defined in the `mirage-kv` package.
The current version supports the `Mirage_kv_lwt.RO` and `Mirage_kv_lwt.RW`
signatures defined in the `mirage-kv-lwt` package.
"""
2 changes: 1 addition & 1 deletion src/dune
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(library
(name mirage_kv_unix)
(public_name mirage-kv-unix)
(libraries mirage-kv-lwt lwt.unix ptime))
(libraries mirage-kv lwt.unix ptime))
3 changes: 0 additions & 3 deletions src/mirage_kv_unix.ml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@

open Lwt.Infix

type +'a io = 'a Lwt.t

type key = Mirage_kv.Key.t
type value = string

type t = {
base: string
Expand Down
2 changes: 1 addition & 1 deletion src/mirage_kv_unix.mli
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
type error = [ Mirage_kv.error | `Storage_error of Mirage_kv.Key.t * string ]
type write_error = [ Mirage_kv.write_error | `Storage_error of Mirage_kv.Key.t * string | `Key_exists of Mirage_kv.Key.t ]

include Mirage_kv_lwt.RW
include Mirage_kv.RW
with type error := error
and type write_error := write_error

Expand Down
4 changes: 2 additions & 2 deletions test/dune
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(executables
(names test_kv_unix)
(libraries unix ptime mirage-clock-unix alcotest rresult mirage-kv-lwt
mirage-kv-unix))
(libraries unix ptime mirage-clock-unix alcotest rresult mirage-kv
mirage-kv-unix cstruct))

(alias
(name runtest)
Expand Down
4 changes: 1 addition & 3 deletions test/test_kv_unix.ml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@ let assert_write_fail e = failf "%a" KV.pp_write_error e
let connect_present_dir () =
KV.connect test_kv >>= fun _kv -> Lwt.return_unit

let clock = lwt_run (fun () -> Pclock.connect ()) ()

let append_timestamp s =
let now = Ptime.v (Pclock.now_d_ps clock) in
let now = Ptime.v (Pclock.now_d_ps ()) in
let str = Fmt.strf "%s-%a" s (Ptime.pp_rfc3339 ~space:false ()) now in
Mirage_kv.Key.v str

Expand Down

0 comments on commit 883bd6b

Please sign in to comment.