package tezos-legacy-store

  1. Overview
  2. Docs

Tezos Shell - Abstraction over all the disk storage.

It encapsulates access to:

  • the index of validation contexts; and
  • the persistent state of the node:
  • the blockchain and its alternate heads ;
  • the pool of pending operations of a chain.
type t
type global_state = t

Network

module Chain : sig ... end

Data specific to a given chain (e.g. the main chain or the current test chain).

Block database

type Tezos_base__TzPervasives.error +=
  1. | Block_not_found of Tezos_crypto.Block_hash.t
type Tezos_base__TzPervasives.error +=
  1. | Block_contents_not_found of Tezos_crypto.Block_hash.t
module Block : sig ... end
val read_block : global_state -> Tezos_crypto.Block_hash.t -> Block.t option Lwt.t
val best_known_head_for_checkpoint : Chain.t -> Tezos_base.Block_header.t -> Block.t Lwt.t

Computes the block with the best fitness amongst the known blocks which are compatible with the given checkpoint.

val update_testchain : Block.t -> testchain_state:Chain.t -> unit Lwt.t
type chain_data = {
  1. current_head : Block.t;
  2. current_mempool : Tezos_base.Mempool.t;
  3. live_blocks : Tezos_crypto.Block_hash.Set.t;
  4. live_operations : Tezos_crypto.Operation_hash.Set.t;
  5. test_chain : Tezos_crypto.Chain_id.t option;
  6. save_point : Stdlib.Int32.t * Tezos_crypto.Block_hash.t;
  7. caboose : Stdlib.Int32.t * Tezos_crypto.Block_hash.t;
}
val read_chain_data : Chain.t -> (Legacy_store.Chain_data.store -> chain_data -> 'a Lwt.t) -> 'a Lwt.t
val update_chain_data : Chain.t -> (Legacy_store.Chain_data.store -> chain_data -> (chain_data option * 'a) Lwt.t) -> 'a Lwt.t

Protocol database

module Protocol : sig ... end
module Current_mempool : sig ... end
type Tezos_base__TzPervasives.error +=
  1. | Incorrect_legacy_history_mode_switch of {
    1. previous_mode : Tezos_shell_services.History_mode.Legacy.t;
    2. next_mode : Tezos_shell_services.History_mode.Legacy.t;
    }
val compute_locator : Chain.t -> ?max_size:int -> Block.t -> Tezos_base.Block_locator.seed -> Tezos_base.Block_locator.t Lwt.t

compute_locator chain ?max_size block seed computes a locator of the chain from head to the chain's caboose or until the locator contains max_size steps. max_size defaults to 200.

val compute_protocol_locator : Chain.t -> ?max_size:int -> proto_level:int -> Tezos_base.Block_locator.seed -> Tezos_base.Block_locator.t option Lwt.t

compute_protocol_locator chain ?max_size ~proto_level seed computes a locator for a specific protocol of level proto_level in the chain from the latest block with this protocol to its activation block or until the locator contains max_size steps. max_size defaults to 200.

val init : ?patch_context: (Tezos_context.Context.t -> (Tezos_context.Context.t, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t) -> ?commit_genesis: (chain_id:Tezos_crypto.Chain_id.t -> (Tezos_crypto.Context_hash.t, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t) -> ?store_mapsize:int64 -> store_root:string -> context_root:string -> ?history_mode:Tezos_shell_services.History_mode.Legacy.t -> ?readonly:bool -> Tezos_base.Genesis.t -> (global_state * Chain.t * Tezos_context.Context.index * Tezos_shell_services.History_mode.Legacy.t, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t

Read the internal state of the node and initialize the databases.

val close : global_state -> unit Lwt.t
OCaml

Innovation. Community. Security.