Skip to content

Commit

Permalink
use ptime directly
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesm committed Dec 3, 2022
1 parent 9d8dbd4 commit 5717c25
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
1 change: 1 addition & 0 deletions mirage-kv.opam
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ depends: [
"fmt" {>= "0.8.7"}
"lwt" {>= "4.0.0"}
"optint" {>= "0.2.0"}
"ptime" {>= "1.0.0"}
"alcotest" {with-test}
]
synopsis: "MirageOS signatures for key/value devices"
Expand Down
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)
(public_name mirage-kv)
(libraries fmt optint lwt))
(libraries fmt optint lwt ptime))
4 changes: 2 additions & 2 deletions src/mirage_kv.ml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ module type RO = sig
val get: t -> key -> (string, error) result Lwt.t
val get_partial: t -> key -> offset:Optint.Int63.t -> length:int -> (string, error) result Lwt.t
val list: t -> key -> ((key * [`Value | `Dictionary]) list, error) result Lwt.t
val last_modified: t -> key -> (int * int64, error) result Lwt.t
val last_modified: t -> key -> (Ptime.t, error) result Lwt.t
val digest: t -> key -> (string, error) result Lwt.t
val size: t -> key -> (Optint.Int63.t, error) result Lwt.t
end
Expand All @@ -88,7 +88,7 @@ module type RW = sig
include RO
type nonrec write_error = private [> write_error]
val pp_write_error: write_error Fmt.t
val allocate : t -> key -> ?last_modified:(int * int64) -> Optint.Int63.t -> (unit, write_error) result Lwt.t
val allocate : t -> key -> ?last_modified:Ptime.t -> Optint.Int63.t -> (unit, write_error) result Lwt.t
val set: t -> key -> string -> (unit, write_error) result Lwt.t
val set_partial: t -> key -> offset:Optint.Int63.t -> string -> (unit, write_error) result Lwt.t
val remove: t -> key -> (unit, write_error) result Lwt.t
Expand Down
9 changes: 2 additions & 7 deletions src/mirage_kv.mli
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,10 @@ module type RO = sig
The result is [Error (`Dictionary_expected k)] if [k] refers to a
value in [t]. *)

val last_modified: t -> key -> (int * int64, error) result Lwt.t
val last_modified: t -> key -> (Ptime.t, error) result Lwt.t
(** [last_modified t k] is the last time the value bound to [k] in
[t] has been modified.
The modification time [(d, ps)] is a span for the signed POSIX
picosecond span [d] * 86_400e12 + [ps]. [d] is a signed number of
POSIX days and [ps] a number of picoseconds in the range
\[[0];[86_399_999_999_999_999L]\].
When the value bound to [k] is a dictionary, the modification
time is the latest modification of all entries in that
dictionary. This behaviour is only one level deep and not recursive. *)
Expand Down Expand Up @@ -204,7 +199,7 @@ module type RW = sig
val pp_write_error: write_error Fmt.t
(** The pretty-printer for [pp_write_error]. *)

val allocate : t -> key -> ?last_modified:(int * int64) -> Optint.Int63.t ->
val allocate : t -> key -> ?last_modified:Ptime.t -> Optint.Int63.t ->
(unit, write_error) result Lwt.t
(** [allocate t key ~last_modified size] allocates space for [key] in [t] with
the provided [size] and [last_modified]. This is useful for e.g.
Expand Down

0 comments on commit 5717c25

Please sign in to comment.