package octez-l2-libs

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Make_append_only_map(S)(K)(V) constructs an Append_only_map which can be persisted on store. The module S defines storage-dependent information about how the map will be saved on and retrieved from the store (for example, it defines the map location in the store). The module K contains information related to keys of the map, and the module V contains information about how values will be stored to and retrieved from the store. The resulting map forbids updating the contents of an existing value with a new value, different from the previous one.

Parameters

module S : STORAGE_INFO
module K : KEY
module V : VALUE

Signature

include Map with type 'a store = 'a t with type key = K.key with type value = V.value
type 'a store = 'a t

The type of the store that is used for persisting data on disk.

type key = K.key

The type of keys persisted by the map.

type value = V.value

The type of values persisted by the map.

val path : path

Path in the irmin tree.

val mem : [> `Read ] store -> key -> bool Tezos_base.TzPervasives.tzresult Lwt.t

mem store key checks whether there is a binding of the map for key key in store.

get store key retrieves from store the value associated with key in the map. It raises an error if such a value does not exist.

val find : [> `Read ] store -> key -> value option Tezos_base.TzPervasives.tzresult Lwt.t

find store key retrieves from store the value associated with key in the map. If the value exists it is returned as an optional value. Otherwise, None is returned.

val find_with_default : [> `Read ] store -> key -> on_default:(unit -> value) -> value Tezos_base.TzPervasives.tzresult Lwt.t

find_with_default ~on_default store key retrieves from store the value associated with key in the map. If the value exists it is returned as is. Otherwise, on_default is returned.

add store key value adds a binding from key to value to the map, and persists it to disk. If key already exists in the store, it must be bound to value.

OCaml

Innovation. Community. Security.