package plebeia

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

Install

Dune Dependency

Authors

Maintainers

Sources

plebeia-2.0.0.tar.gz
md5=f528f42d3e72d400265eb6bc51901fca
sha512=6cf070b2f1ea2e570a106b231a7e8e40c64c91c5a7abeddf072a5c413e74d5d9dd9b7df674cca559ddb33cabc9c0ec0b3a001306397d11b62888aac4cca9fd7e

doc/plebeia/Plebeia/Context/index.html

Module Plebeia.ContextSource

1 Merkle Patricia tree storage

2 Types

Sourcetype t = {
  1. storage : Storage.t;
  2. hashcons : Hashcons.t;
  3. node_cache : Index.t Node_cache.t;
  4. stat : Stat.t;
  5. hash : Hash.Hasher.t;
  6. keep_hash : bool;
  7. bytes_per_cell : int;
}
Sourcetype config = {
  1. bytes_per_cell : int;
  2. hash_func : [ `Blake2B | `Blake3 ];
  3. bytes_per_hash : int;
}

Configuration which affect data file and hashes

Sourceval get_config : t -> config

Build the config. Do not call it in busy loops since it allocates a record

Sourceval pp_config : Format.formatter -> config -> unit
Sourceval config_name : config -> string

Short string to identify configs

Sourceval get_storage : t -> Storage.t
Sourceval memory_only : ?hashcons:Hashcons.config -> ?bytes_per_cell:int -> ?hash_func:[ `Blake2B | `Blake3 ] -> ?bytes_per_hash:int -> ?keep_hash:bool -> unit -> t

Create a memory_only context.

Commiting nodes of a memory only context fails.

Sourceval is_memory_only : t -> bool
Sourceval create : ?hashcons:Hashcons.config -> ?node_cache:Index.t Node_cache.t -> ?bytes_per_cell:int -> ?hash_func:[ `Blake2B | `Blake3 ] -> ?bytes_per_hash:int -> ?resize_step_bytes:int -> ?keep_hash:bool -> string -> t Lwt.t

Create a new context storage. Note that if the file already exists, create fails.

The context is created in Writer mode.

length: initial size of the file in bytes

Sourceval open_ : ?hashcons:Hashcons.config -> ?node_cache:Index.t Node_cache.t -> mode:Storage.mode -> ?bytes_per_cell:int -> ?hash_func:[ `Blake2B | `Blake3 ] -> ?bytes_per_hash:int -> ?resize_step_bytes:int -> ?keep_hash:bool -> string -> t Lwt.t

Open an existing context storage.

Sourceval close : t -> unit Lwt.t

Closes the context.

If program exits or crashes without closing a context, some data may be lost, even if they are written on the disk.

Sourceval mode : t -> Storage.mode

Returns writing mode

Sourceval shrink_node_cache : t -> unit

Shrink the node cache

Sourceval pp_cache_for_debug : Format.formatter -> t -> unit

It runs Obj.reachable_words which takes long time. Do not use in production.

OCaml

Innovation. Community. Security.