package tezos-protocol-012-Psithaca

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

An INTERFACE to the subcache where keys live in a given namespace.

type cached_value

The type of value to be stored in the cache.

val update : Raw_context.t -> identifier -> (cached_value * size) option -> (Raw_context.t, Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.trace) result

update ctxt i (Some (e, size)) returns a context where the value e of given size is associated to identifier i in the subcache. If i is already in the subcache, the cache entry is updated.

update ctxt i None removes i from the subcache.

val find : Raw_context.t -> identifier -> (cached_value option, Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.trace) result Lwt.t

find ctxt i = Some v if v is the value associated to i in the subcache. Returns None if there is no such value in the subcache. This function is in the Lwt monad because if the value may have not been constructed (see the lazy loading mode in Environment_context), it is constructed on the fly.

val list_identifiers : Raw_context.t -> (string * int) list

list_identifiers ctxt returns the list of the identifiers of the cached values along with their respective size. The returned list is sorted in terms of their age in the cache, the oldest coming first.

val identifier_rank : Raw_context.t -> string -> int option

identifier_rank ctxt identifier returns the number of cached values older than the one of identifier; or, None if the identifier has no associated value in the subcache.

val size : Raw_context.t -> int

size ctxt returns an overapproximation of the subcache size (in bytes).

val size_limit : Raw_context.t -> int

size_limit ctxt returns the maximal size of the subcache (in bytes).

OCaml

Innovation. Community. Security.