2019-09-05 17:21:01 +04:00
|
|
|
(*****************************************************************************)
|
|
|
|
(* *)
|
|
|
|
(* Open Source License *)
|
|
|
|
(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
|
|
(* *)
|
|
|
|
(* Permission is hereby granted, free of charge, to any person obtaining a *)
|
|
|
|
(* copy of this software and associated documentation files (the "Software"),*)
|
|
|
|
(* to deal in the Software without restriction, including without limitation *)
|
|
|
|
(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)
|
|
|
|
(* and/or sell copies of the Software, and to permit persons to whom the *)
|
|
|
|
(* Software is furnished to do so, subject to the following conditions: *)
|
|
|
|
(* *)
|
|
|
|
(* The above copyright notice and this permission notice shall be included *)
|
|
|
|
(* in all copies or substantial portions of the Software. *)
|
|
|
|
(* *)
|
|
|
|
(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)
|
|
|
|
(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)
|
|
|
|
(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)
|
|
|
|
(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)
|
|
|
|
(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)
|
|
|
|
(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)
|
|
|
|
(* DEALINGS IN THE SOFTWARE. *)
|
|
|
|
(* *)
|
|
|
|
(*****************************************************************************)
|
|
|
|
|
|
|
|
(** Tezos Protocol Implementation - Typed storage builders. *)
|
|
|
|
|
|
|
|
open Storage_sigs
|
|
|
|
|
2019-10-17 13:45:27 +04:00
|
|
|
module Registered : REGISTER
|
2020-02-12 20:40:17 +04:00
|
|
|
|
2019-10-17 13:45:27 +04:00
|
|
|
module Ghost : REGISTER
|
|
|
|
|
2020-02-12 20:40:17 +04:00
|
|
|
module Make_subcontext (R : REGISTER) (C : Raw_context.T) (N : NAME) :
|
|
|
|
Raw_context.T with type t = C.t
|
2019-09-05 17:21:01 +04:00
|
|
|
|
|
|
|
module Make_single_data_storage
|
2020-02-12 20:40:17 +04:00
|
|
|
(R : REGISTER)
|
|
|
|
(C : Raw_context.T)
|
|
|
|
(N : NAME)
|
|
|
|
(V : VALUE) : Single_data_storage with type t = C.t and type value = V.t
|
2019-09-05 17:21:01 +04:00
|
|
|
|
|
|
|
module type INDEX = sig
|
|
|
|
type t
|
2020-02-12 20:40:17 +04:00
|
|
|
|
|
|
|
val path_length : int
|
|
|
|
|
|
|
|
val to_path : t -> string list -> string list
|
|
|
|
|
|
|
|
val of_path : string list -> t option
|
|
|
|
|
2019-09-05 17:21:01 +04:00
|
|
|
type 'a ipath
|
2020-02-12 20:40:17 +04:00
|
|
|
|
|
|
|
val args : ('a, t, 'a ipath) Storage_description.args
|
2019-09-05 17:21:01 +04:00
|
|
|
end
|
|
|
|
|
2020-02-12 20:40:17 +04:00
|
|
|
module Pair (I1 : INDEX) (I2 : INDEX) : INDEX with type t = I1.t * I2.t
|
2019-09-05 17:21:01 +04:00
|
|
|
|
2020-02-12 20:40:17 +04:00
|
|
|
module Make_data_set_storage (C : Raw_context.T) (I : INDEX) :
|
|
|
|
Data_set_storage with type t = C.t and type elt = I.t
|
2019-09-05 17:21:01 +04:00
|
|
|
|
2020-02-12 20:40:17 +04:00
|
|
|
module Make_indexed_data_storage (C : Raw_context.T) (I : INDEX) (V : VALUE) :
|
|
|
|
Indexed_data_storage
|
|
|
|
with type t = C.t
|
|
|
|
and type key = I.t
|
|
|
|
and type value = V.t
|
2019-09-05 17:21:01 +04:00
|
|
|
|
|
|
|
module Make_indexed_carbonated_data_storage
|
2020-02-12 20:40:17 +04:00
|
|
|
(C : Raw_context.T)
|
|
|
|
(I : INDEX)
|
|
|
|
(V : VALUE) :
|
|
|
|
Non_iterable_indexed_carbonated_data_storage
|
|
|
|
with type t = C.t
|
|
|
|
and type key = I.t
|
|
|
|
and type value = V.t
|
|
|
|
|
|
|
|
module Make_indexed_data_snapshotable_storage
|
|
|
|
(C : Raw_context.T)
|
|
|
|
(Snapshot : INDEX)
|
|
|
|
(I : INDEX)
|
|
|
|
(V : VALUE) :
|
|
|
|
Indexed_data_snapshotable_storage
|
|
|
|
with type t = C.t
|
|
|
|
and type snapshot = Snapshot.t
|
|
|
|
and type key = I.t
|
|
|
|
and type value = V.t
|
|
|
|
|
|
|
|
module Make_indexed_subcontext (C : Raw_context.T) (I : INDEX) :
|
|
|
|
Indexed_raw_context
|
|
|
|
with type t = C.t
|
|
|
|
and type key = I.t
|
|
|
|
and type 'a ipath = 'a I.ipath
|
2019-09-05 17:21:01 +04:00
|
|
|
|
|
|
|
module Wrap_indexed_data_storage
|
2020-02-12 20:40:17 +04:00
|
|
|
(C : Indexed_data_storage) (K : sig
|
|
|
|
type t
|
|
|
|
|
|
|
|
val wrap : t -> C.key
|
|
|
|
|
|
|
|
val unwrap : C.key -> t option
|
|
|
|
end) :
|
|
|
|
Indexed_data_storage
|
|
|
|
with type t = C.t
|
|
|
|
and type key = K.t
|
|
|
|
and type value = C.value
|