package octez-l2-libs

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

BACKEND is the module type defining the backend for persisting data to disk. It is used by the functors in Store_utils to create Storage modules that persist data structures on disk.

type +'a t

The type for representing storage backends that can be accessed by the module. The type parameter indicates whether the storage can be only read or both read and written.

val name : string

name is the name of the store.

val make_key_path : path -> key_path_representation -> path

make_key_path path raw_key constructs a new path from path and the raw_key key_path_representation.

val load : 'a mode -> string -> 'a t Tezos_base.TzPervasives.tzresult Lwt.t

load location loads the backend storage from location.

val flush : [> `Write ] t -> unit Tezos_base.TzPervasives.tzresult

flush location flushes to disk a sequence of changes to the data stored at location.

close t closes the storage backend t.

val set : [> `Write ] t -> path -> bytes -> unit Tezos_base.TzPervasives.tzresult Lwt.t

set_exn t path b sets the contents for the store t at path to the sequence of bytes b. The write operation can fail, in which case an exception is thrown.

val get : [> `Read ] t -> path -> bytes Tezos_base.TzPervasives.tzresult Lwt.t

get t path returns the contents for the store t at the location indicated by path. It can fail if t does not have any content stored at path.

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

mem t path returns whether the storage backend t contains any data at the location indicated by path.

val find : [> `Read ] t -> path -> bytes option Tezos_base.TzPervasives.tzresult Lwt.t

find t path is the same as get t path, except that an optional value is returned. This value is None if the backend storage t does not have any content stored at location path.

val path_to_string : path -> string

path_to_string converts a path to a string.

val readonly : [> `Read ] t -> [ `Read ] t

readonly t returns a read only version of the storage t.

OCaml

Innovation. Community. Security.