Functional storage using Merkle Patricia tree
Module type
Class type
Library plebeia
exception ReadFailure of Error.t
val write_node : ?clear:bool -> Context.t -> Node_type.node -> ( Node_type.node * Index.t * Hash.Prefix.t, Error.t ) Stdlib.result

Write a node to the storage, and returns the updated version of the node with its index and hash.

If clear=true, then it forgets the details of the given node after the commit and returns a Disk _ node points to the commit.

Note that this function does not update the header. Storage.commit must be called to make the written node persistent.

Read the node at the given index of the context, parse it and create a view node with it.

Note: load_node does not load the hash. Use load_hash_prefix for hashes.

val read_hash : Context.t -> Node_type.t -> [> `Hashed of Hash.t * Node_type.t | `Not_Hashed of Node_type.view ]

Read hash if it is not yet

exception HashOnly of Hash.t

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

If the node is Hash h, it raises HashOnly h.

Note: view does not load the hash.

val read_node_fully : reset_index:bool -> Context.t -> Node_type.node -> Node_type.node

Recusively visit and load all the subnodes in memory.

(if reset_index, all the indices are reset to Not_Indexed.)

Note: load_node_fully does not load the hash.

val change_context : src:Context.t -> dst:Context.t -> Node_type.node -> Node_type.node

Copy the node from src context to another context dst

module Internal : sig ... end