Module Persistent_frontier.Database

This module implements the RocksDB interface for interacting with the * persistent frontier's database. This interface includes all of the * basic low level interactions with the database, as well as functionality * for checking the database for structural errors (corruption). Errors * returned from this module come in the form of polymorphic variants. * The Error module is provided as a simple interface for converting * these polymorphic variant errors into human readable strings.

type t
module Error : sig ... end
val create : logger:Logger.t -> directory:string -> t
val close : t -> unit
val check : t -> genesis_state_hash:Mina_base.State_hash.t -> ( Mina_base.Frozen_ledger_hash.t, [> `Not_initialized | `Invalid_version | `Genesis_state_mismatch of Mina_base.State_hash.t | `Corrupt of [> `Not_found of [> `Best_tip | `Best_tip_transition | `Frontier_hash | `Root | `Root_transition | `Transition of Mina_base.State_hash.t | `Arcs of Mina_base.State_hash.t | `Protocol_states_for_root_scan_state ] | `Raised of Core_kernel.Error.t ] ] ) Core_kernel.Result.t
val initialize : t -> root_data:Frontier_base.Root_data.Limited.t -> unit
val add : t -> transition:Mina_block.Validated.t -> ( unit, [> `Not_found of [> `Parent_transition of Mina_base.State_hash.t | `Arcs of Mina_base.State_hash.t ] ] ) Core_kernel.Result.t
val move_root : t -> new_root:Frontier_base.Root_data.Limited.t -> garbage:Mina_base.State_hash.t list -> ( Mina_base.State_hash.t, [> `Not_found of [> `New_root_transition | `Old_root_transition ] ] ) Core_kernel.Result.t
val get_transition : t -> Mina_base.State_hash.t -> ( Mina_block.Validated.t, [> `Not_found of [> `Transition of Mina_base.State_hash.t ] ] ) Core_kernel.Result.t
val get_arcs : t -> Mina_base.State_hash.t -> ( Mina_base.State_hash.t list, [> `Not_found of [> `Arcs of Mina_base.State_hash.t ] ] ) Core_kernel.Result.t
val get_root : t -> ( Frontier_base.Root_data.Minimal.t, [> `Not_found of [> `Root ] ] ) Core_kernel.Result.t
val get_protocol_states_for_root_scan_state : t -> ( Mina_state.Protocol_state.value list, [> `Not_found of [> `Protocol_states_for_root_scan_state ] ] ) Core_kernel.Result.t
val get_root_hash : t -> ( Mina_base.State_hash.t, [> `Not_found of [> `Root ] ] ) Core_kernel.Result.t
val get_best_tip : t -> ( Mina_base.State_hash.t, [> `Not_found of [> `Best_tip ] ] ) Core_kernel.Result.t
val set_best_tip : t -> Mina_base.State_hash.t -> ( Mina_base.State_hash.t, [> `Not_found of [> `Best_tip ] ] ) Core_kernel.Result.t
val crawl_successors : t -> Mina_base.State_hash.t -> init:'a -> f: ( 'a -> Mina_block.Validated.t -> ( 'a, 'b ) Async_kernel.Deferred.Result.t ) -> ( unit, [> `Crawl_error of 'b | `Not_found of [> `Arcs of Mina_base.State_hash.t | `Transition of Mina_base.State_hash.t ] ] ) Async_kernel.Deferred.Result.t