• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

MinaProtocol / mina / 2817

23 Oct 2024 05:55PM UTC coverage: 33.411% (-27.7%) from 61.089%
2817

push

buildkite

web-flow
Merge pull request #16270 from MinaProtocol/dkijania/fix_promotion_job

Fix verify promoted docker check

22271 of 66658 relevant lines covered (33.41%)

131054.24 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

13.33
/src/lib/key_value_database/key_value_database.ml
1
open Core_kernel
8✔
2

3
module Monad = struct
4
  module type S = sig
5
    type 'a t
6

7
    include Monad.S with type 'a t := 'a t
8

9
    module Result : sig
10
      val lift : 'value t -> ('value, 'err) Result.t t
11

12
      type nonrec ('value, 'err) t = ('value, 'err) Result.t t
13

14
      include Monad.S2 with type ('value, 'err) t := ('value, 'err) t
15
    end
16

17
    module Option : sig
18
      type nonrec 'a t = 'a option t
19

20
      include Monad.S with type 'a t := 'a t
21
    end
22
  end
23

24
  module Ident = struct
25
    include Monad.Ident
26

27
    module Result = struct
28
      let lift = Result.return
29

30
      include Result
31
    end
32

33
    module Option = Option
34
  end
35
end
36

37
module Intf = struct
38
  module type S = sig
39
    type t
40

41
    type key
42

43
    type value
44

45
    type config
46

47
    module M : Monad.S
48

49
    val create : config -> t
50

51
    val close : t -> unit
52

53
    val get : t -> key:key -> value option M.t
54

55
    val get_batch : t -> keys:key list -> value option list M.t
56

57
    val set : t -> key:key -> data:value -> unit M.t
58

59
    val remove : t -> key:key -> unit M.t
60

61
    val set_batch :
62
      t -> ?remove_keys:key list -> update_pairs:(key * value) list -> unit M.t
63

64
    val to_alist : t -> (key * value) list M.t
65
  end
66

67
  module type Ident = S with module M := Monad.Ident
68

69
  module type Mock = sig
70
    include Ident
71

72
    val random_key : t -> key option
73

74
    val to_sexp :
75
      t -> key_sexp:(key -> Sexp.t) -> value_sexp:(value -> Sexp.t) -> Sexp.t
76
  end
77
end
78

79
module Make_mock
80
    (Key : Hashable.S) (Value : sig
81
      type t
82
    end) :
83
  Intf.Mock
84
    with type t = Value.t Key.Table.t
85
     and type key := Key.t
86
     and type value := Value.t
87
     and type config := unit = struct
88
  type t = Value.t Key.Table.t
89

90
  let to_sexp t ~key_sexp ~value_sexp =
91
    Key.Table.to_alist t
×
92
    |> List.map ~f:(fun (key, value) ->
×
93
           [%sexp_of: Sexp.t * Sexp.t] (key_sexp key, value_sexp value) )
×
94
    |> [%sexp_of: Sexp.t list]
95

96
  let create _ = Key.Table.create ()
×
97

98
  let get t ~key = Key.Table.find t key
×
99

100
  let get_batch t ~keys = List.map keys ~f:(Key.Table.find t)
×
101

102
  let set = Key.Table.set
103

104
  let remove t ~key = Key.Table.remove t key
×
105

106
  let close _ = ()
×
107

108
  let random_key t =
109
    let keys = Key.Table.keys t in
×
110
    List.random_element keys
×
111

112
  let set_batch t ?(remove_keys = []) ~update_pairs =
×
113
    List.iter update_pairs ~f:(fun (key, data) -> set t ~key ~data) ;
×
114
    List.iter remove_keys ~f:(fun key -> remove t ~key)
×
115

116
  let to_alist = Key.Table.to_alist
117
end
16✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc