2016-09-08 21:13:10 +04:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
2018-02-06 00:17:03 +04:00
|
|
|
(* Copyright (c) 2014 - 2018. *)
|
2016-09-08 21:13:10 +04:00
|
|
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
|
|
(* *)
|
|
|
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
|
2017-02-24 20:17:53 +04:00
|
|
|
open Store_sigs
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-02-24 20:17:53 +04:00
|
|
|
type t
|
|
|
|
type global_store = t
|
|
|
|
|
2018-05-25 18:57:44 +04:00
|
|
|
(** [init ~mapsize path] returns an initialized store at [path] of
|
|
|
|
maximum capacity [mapsize] bytes. *)
|
|
|
|
val init: ?mapsize:int64 -> string -> t tzresult Lwt.t
|
2017-05-31 20:27:11 +04:00
|
|
|
val close : t -> unit
|
2017-02-24 20:17:53 +04:00
|
|
|
|
|
|
|
|
2018-02-16 04:26:24 +04:00
|
|
|
(** {2 Chain store} **********************************************************)
|
2017-02-24 20:17:53 +04:00
|
|
|
|
2018-02-16 04:26:24 +04:00
|
|
|
module Chain : sig
|
2017-02-24 20:17:53 +04:00
|
|
|
|
2018-02-16 04:26:24 +04:00
|
|
|
val list: global_store -> Chain_id.t list Lwt.t
|
|
|
|
val destroy: global_store -> Chain_id.t -> unit Lwt.t
|
2017-02-24 20:17:53 +04:00
|
|
|
|
|
|
|
type store
|
2018-02-16 04:26:24 +04:00
|
|
|
val get: global_store -> Chain_id.t -> store
|
2017-02-24 20:17:53 +04:00
|
|
|
|
2017-03-31 15:04:05 +04:00
|
|
|
module Genesis_hash : SINGLE_STORE
|
|
|
|
with type t := store
|
|
|
|
and type value := Block_hash.t
|
|
|
|
|
2017-02-24 20:17:53 +04:00
|
|
|
module Genesis_time : SINGLE_STORE
|
|
|
|
with type t := store
|
|
|
|
and type value := Time.t
|
|
|
|
|
|
|
|
module Genesis_protocol : SINGLE_STORE
|
|
|
|
with type t := store
|
|
|
|
and type value := Protocol_hash.t
|
|
|
|
|
|
|
|
module Genesis_test_protocol : SINGLE_STORE
|
|
|
|
with type t := store
|
|
|
|
and type value := Protocol_hash.t
|
|
|
|
|
|
|
|
module Expiration : SINGLE_STORE
|
|
|
|
with type t := store
|
|
|
|
and type value := Time.t
|
|
|
|
|
2018-02-16 04:26:24 +04:00
|
|
|
module Allow_forked_chain : SET_STORE
|
2017-04-10 23:14:17 +04:00
|
|
|
with type t := t
|
2018-02-16 04:26:24 +04:00
|
|
|
and type elt := Chain_id.t
|
2017-02-24 20:17:53 +04:00
|
|
|
|
2016-09-08 21:13:10 +04:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2018-02-16 04:26:24 +04:00
|
|
|
(** {2 Mutable chain data} *******************************************************)
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2018-02-16 04:26:24 +04:00
|
|
|
module Chain_data : sig
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-02-24 20:17:53 +04:00
|
|
|
type store
|
2018-02-16 04:26:24 +04:00
|
|
|
val get: Chain.store -> store
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-02-24 20:17:53 +04:00
|
|
|
module Current_head : SINGLE_STORE
|
|
|
|
with type t := store
|
|
|
|
and type value := Block_hash.t
|
|
|
|
|
|
|
|
module Known_heads : BUFFERED_SET_STORE
|
|
|
|
with type t := store
|
|
|
|
and type elt := Block_hash.t
|
|
|
|
and module Set := Block_hash.Set
|
|
|
|
|
2018-02-16 04:26:24 +04:00
|
|
|
module In_main_branch : SINGLE_STORE
|
2017-02-24 20:17:53 +04:00
|
|
|
with type t = store * Block_hash.t
|
2017-04-19 23:46:10 +04:00
|
|
|
and type value := Block_hash.t (* successor *)
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-02-24 20:17:53 +04:00
|
|
|
end
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
|
2017-02-24 20:17:53 +04:00
|
|
|
(** {2 Block header store} **************************************************)
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-04-19 23:46:10 +04:00
|
|
|
module Block : sig
|
2016-10-21 16:01:20 +04:00
|
|
|
|
2017-02-24 20:17:53 +04:00
|
|
|
type store
|
2018-02-16 04:26:24 +04:00
|
|
|
val get: Chain.store -> store
|
2017-02-24 20:17:53 +04:00
|
|
|
|
2017-04-19 23:46:10 +04:00
|
|
|
type contents = {
|
|
|
|
header: Block_header.t ;
|
2017-12-05 18:18:05 +04:00
|
|
|
message: string option ;
|
2017-04-18 13:29:14 +04:00
|
|
|
max_operations_ttl: int ;
|
2017-12-05 18:17:54 +04:00
|
|
|
context: Context_hash.t ;
|
2018-04-16 02:44:20 +04:00
|
|
|
metadata: MBytes.t ;
|
2017-04-19 23:46:10 +04:00
|
|
|
}
|
2016-10-21 16:01:20 +04:00
|
|
|
|
2017-04-19 23:46:10 +04:00
|
|
|
module Contents : SINGLE_STORE
|
2017-03-30 15:16:21 +04:00
|
|
|
with type t = store * Block_hash.t
|
2017-04-19 23:46:10 +04:00
|
|
|
and type value := contents
|
2017-03-30 15:16:21 +04:00
|
|
|
|
2017-04-19 23:46:10 +04:00
|
|
|
module Operation_hashes : MAP_STORE
|
2017-03-30 15:16:21 +04:00
|
|
|
with type t = store * Block_hash.t
|
|
|
|
and type key = int
|
|
|
|
and type value = Operation_hash.t list
|
|
|
|
|
2017-04-19 23:46:10 +04:00
|
|
|
module Operation_path : MAP_STORE
|
2017-03-30 15:16:21 +04:00
|
|
|
with type t = store * Block_hash.t
|
|
|
|
and type key = int
|
|
|
|
and type value = Operation_list_list_hash.path
|
|
|
|
|
2017-04-19 23:46:10 +04:00
|
|
|
module Operations : MAP_STORE
|
|
|
|
with type t = store * Block_hash.t
|
|
|
|
and type key = int
|
|
|
|
and type value = Operation.t list
|
|
|
|
|
2018-04-16 02:44:20 +04:00
|
|
|
module Operations_metadata : MAP_STORE
|
|
|
|
with type t = store * Block_hash.t
|
|
|
|
and type key = int
|
|
|
|
and type value = MBytes.t list
|
|
|
|
|
2017-04-19 23:46:10 +04:00
|
|
|
type invalid_block = {
|
|
|
|
level: int32 ;
|
2017-10-31 20:59:02 +04:00
|
|
|
errors: Error_monad.error list ;
|
2017-04-19 23:46:10 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
module Invalid_block : MAP_STORE
|
|
|
|
with type t = store
|
|
|
|
and type key = Block_hash.t
|
|
|
|
and type value = invalid_block
|
|
|
|
|
2018-01-22 21:16:26 +04:00
|
|
|
(**
|
|
|
|
Block predecessors under
|
|
|
|
[/blocks/<block_id>/predecessors/<distance>/<block_id>].
|
|
|
|
Used to compute block predecessors in [lib_node_shell/state.ml].
|
|
|
|
*)
|
|
|
|
module Predecessors : MAP_STORE
|
|
|
|
with type t = store * Block_hash.t
|
|
|
|
and type key = int
|
|
|
|
and type value = Block_hash.t
|
|
|
|
|
2016-10-21 16:01:20 +04:00
|
|
|
end
|
|
|
|
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-02-24 20:17:53 +04:00
|
|
|
(** {2 Protocol store} ******************************************************)
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-02-24 20:17:53 +04:00
|
|
|
module Protocol : sig
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-02-24 20:17:53 +04:00
|
|
|
type store
|
|
|
|
val get: global_store -> store
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-04-19 23:46:10 +04:00
|
|
|
module Contents : MAP_STORE
|
|
|
|
with type t := store
|
|
|
|
and type key := Protocol_hash.t
|
|
|
|
and type value := Protocol.t
|
|
|
|
|
|
|
|
module RawContents : SINGLE_STORE
|
|
|
|
with type t = store * Protocol_hash.t
|
|
|
|
and type value := MBytes.t
|
2016-10-21 16:01:20 +04:00
|
|
|
|
2017-02-24 20:17:53 +04:00
|
|
|
end
|