package plebeia

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
exception ReadFailure of Error.t
val write_node : ?clear:bool -> Context.t -> Node_type.node -> (Node_type.node * Index.t * Hash.Prefix.t * int option, 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.

Exception: 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.

This function assumes src and dst use the same hashing. If their hashings are incompatible, it raises Invalid_argument _.

val count_itself : Context.t -> Node_type.node -> (int * Node_type.node) option

count the leaves and buds, loading nodes on demand.

count_itself ctxt n returns 1 when n is Bud, not the numbers of the leaves and buds under the bud.

Returns None when the pagination count is not in the context.

val count : Context.t -> Node_type.node -> (int * Node_type.node) option

count the leaves and buds, loading nodes on demand.

count ctxt n, if n is a Bud, returns the number of the leaves and buds under n.

Returns None when the pagination count is not in the context.

val read_leaf_value : Context.t -> Node_type.view -> Value.t
module Internal : sig ... end
OCaml

Innovation. Community. Security.