Debian Codegraph @

plugins/micromega/persistent_cache.mli

raw symbols SCIP
1 (************************************************************************)
2 (* * The Rocq Prover / The Rocq Development Team *)
3 (* v * Copyright INRIA, CNRS and contributors *)
4 (* <O___,, * (see version control and CREDITS file for authors & dates) *)
5 (* \VV/ **************************************************************)
6 (* // * This file is distributed under the terms of the *)
7 (* * GNU Lesser General Public License Version 2.1 *)
8 (* * (see LICENSE file for the text of the license) *)
9 (************************************************************************)
10
11 open Hashtbl
12
13 module type PHashtable = sig
14 type 'a t
15 type key
16
17 (** [open_in f] rebuilds a table from the records stored in file [f].
18 As marshaling is not type-safe, it might segfault.
19 *)
20 val open_in : string -> 'a t
21
22 (** find has the specification of Hashtable.find *)
23 val find : 'a t -> key -> 'a
24
25 (** [add tbl key elem] adds the binding [key] [elem] to the table [tbl].
26 (and writes the binding to the file associated with [tbl].)
27 If [key] is already bound, raises KeyAlreadyBound *)
28 val add : 'a t -> key -> 'a -> unit
29
30 (** [memo cache f] returns a memo function for [f] using file [cache] as persistent table.
31 Note that the cache will only be loaded when the function is used for the first time *)
32 val memo : string -> (key -> 'a) -> key -> 'a
33
34 (** [memo cache cond f] only use the cache if [cond k] holds for the key [k]. *)
35 val memo_cond : string -> (key -> bool) -> (key -> 'a) -> key -> 'a
36 end
37
38 module PHashtable (Key : HashedType) : PHashtable with type key = Key.t