package plebeia

  1. Overview
  2. Docs
Functional storage using Merkle Patricia tree

Install

Dune Dependency

Authors

Maintainers

Sources

plebeia-2.1.0.tar.gz
md5=104e71a50a29b96a4b508004a539c88a
sha512=5edcd6c73dc276011c6344e121e978d294e3b8847ce6e8b28b03a2c7f3ed6bd1a860775dfb9d5b399442d66eeffcb45d9aab6f08b4accdf9287b5b7dbbf91506

doc/plebeia/Plebeia/Node/index.html

Module Plebeia.NodeSource

include module type of struct include Node_type end

2 Types

Sourcetype hashed = Node_type.hashed =
  1. | Hashed of Hash.Prefix.t
  2. | Not_Hashed
    (*

    Type used to prove that if a node is hashed then so are its children. The type also provides the hash as a witness.

    *)
Sourcetype indexed = Node_type.indexed =
  1. | Indexed of Index.t
  2. | Not_Indexed
    (*

    This rule expresses the following invariant : if a node is indexed, then its children are necessarily indexed. Less trivially, if an internal node is not indexed then at least one of its children is not yet indexed. The reason is that we never construct new nodes that just point to only existing nodes. This property guarantees that when we write internal nodes on disk, at least one of the child can be written adjacent to its parent.

    *)
Sourcetype extender_witness = Node_type.extender_witness =
  1. | Maybe_Extender
  2. | Not_Extender
  3. | Is_Extender
Sourcetype node = Node_type.node =
  1. | Disk of Index.t * extender_witness
  2. | View of view
  3. | Hash of Hash.t
Sourceand view = private Node_type.view =
  1. | Internal of node * node * indexed * hashed
  2. | Bud of node option * indexed * hashed
  3. | Leaf of Value.t * indexed * hashed
  4. | Extender of Segment.t * node * indexed * hashed

view constructors are private. Use _Internal, _Bud, _Leaf, and _Extender functions with runtime invariant checks.

Sourcetype t = node

2 Constructors with invariant checks

Sourceval _Internal : (node * node * indexed * hashed) -> view
Sourceval _Bud : (node option * indexed * hashed) -> view
Sourceval _Leaf : (Value.t * indexed * hashed) -> view
Sourceval _Extender : (Segment.t * node * indexed * hashed) -> view

2 Accessors

Sourceval indexed : node -> bool
Sourceval index : node -> Index.t option
Sourceval hashed : node -> bool
Sourceval hash_available : node -> bool
Sourceval index_of_view : view -> Index.t option
Sourceval hash_prefix_of_view : view -> Hash.Prefix.t option

2 Tools to create Not_Indexed and Not_Hashed nodes

Sourceval new_internal : node -> node -> node
Sourceval new_bud : node option -> node
Sourceval new_leaf : Value.t -> node
Sourceval new_extender : Segment.t -> node -> node

2 Loading of nodes

Sourceval may_forget : node -> node option

If the node is indexed, forget the details

2 Debug

Sourceval pp : Format.formatter -> node -> unit

Pretty printer

2 Mapper

Sourcemodule Mapper = Node_type.Mapper
Sourcemodule Fold = Node_type.Fold
Sourcemodule Fold' = Node_type.Fold'
Sourceval hash_of_view : view -> Hash.t option
Sourceval hash_of_node : node -> view option * Hash.t option

Random generators

Sourceval gen_leaf : t Gen.t
Sourceval gen_bud_none : t Gen.t
Sourceval gen_bud : int -> t Gen.t

gen_bud depth is a generator of Bud node with about depth sides

Sourceval gen_internal : int -> t Gen.t

gen_bud depth is a generator of Internal node with about depth sides

Sourceval gen_extender : int -> t Gen.t

gen_bud depth is a generator of Extender node with about depth sides

Node reading from a context

Obtain the view of the node. If the view is not available in the memory, it is loaded from the storage.

Compute the hash of the node with its view

OCaml

Innovation. Community. Security.