package tezos-protocol-007-PsDELPH1

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

Variant of Single_data_storage with gas accounting.

type t
type context = t
type value

The type of the value

val mem : context -> (Raw_context.t * bool, Tezos_protocol_environment_007_PsDELPH1__Environment.Error_monad.error list) result Lwt.t

Tells if the data is already defined. Consumes Gas_repr.read_bytes_cost Z.zero.

val get : context -> (Raw_context.t * value, Tezos_protocol_environment_007_PsDELPH1__Environment.Error_monad.error list) result Lwt.t

Retrieve the value from the storage bucket ; returns a Storage_error if the key is not set or if the deserialisation fails. Consumes Gas_repr.read_bytes_cost <size of the value>.

val get_option : context -> (Raw_context.t * value option, Tezos_protocol_environment_007_PsDELPH1__Environment.Error_monad.error list) result Lwt.t

Retrieves the value from the storage bucket ; returns None if the data is not initialized, or Storage_helpers.Storage_error if the deserialisation fails. Consumes Gas_repr.read_bytes_cost <size of the value> if present or Gas_repr.read_bytes_cost Z.zero.

val init : context -> value -> (Raw_context.t * int, Tezos_protocol_environment_007_PsDELPH1__Environment.Error_monad.error list) result Lwt.t

Allocates the storage bucket and initializes it ; returns a Storage_errorMissing_key if the bucket exists. Consumes Gas_repr.write_bytes_cost <size of the value>. Returns the size.

val set : context -> value -> (Raw_context.t * int, Tezos_protocol_environment_007_PsDELPH1__Environment.Error_monad.error list) result Lwt.t

Updates the content of the bucket ; returns a Storage_Error Existing_key if the value does not exists. Consumes Gas_repr.write_bytes_cost <size of the new value>. Returns the difference from the old to the new size.

val init_set : context -> value -> (Raw_context.t * int * bool, Tezos_protocol_environment_007_PsDELPH1__Environment.Error_monad.error list) result Lwt.t

Allocates the data and initializes it with a value ; just updates it if the bucket exists. Consumes Gas_repr.write_bytes_cost <size of the new value>. Returns the difference from the old (maybe 0) to the new size, and a boolean indicating if a value was already associated to this key.

val set_option : context -> value option -> (Raw_context.t * int * bool, Tezos_protocol_environment_007_PsDELPH1__Environment.Error_monad.error list) result Lwt.t

When the value is Some v, allocates the data and initializes it with v ; just updates it if the bucket exists. When the value is None, delete the storage bucket when the value ; does nothing if the bucket does not exists. Consumes the same gas cost as either remove or init_set. Returns the difference from the old (maybe 0) to the new size, and a boolean indicating if a value was already associated to this key.

val delete : context -> (Raw_context.t * int, Tezos_protocol_environment_007_PsDELPH1__Environment.Error_monad.error list) result Lwt.t

Delete the storage bucket ; returns a Storage_error Missing_key if the bucket does not exists. Consumes Gas_repr.write_bytes_cost Z.zero. Returns the freed size.

val remove : context -> (Raw_context.t * int * bool, Tezos_protocol_environment_007_PsDELPH1__Environment.Error_monad.error list) result Lwt.t

Removes the storage bucket and its contents ; does nothing if the bucket does not exists. Consumes Gas_repr.write_bytes_cost Z.zero. Returns the freed size, and a boolean indicating if a value was already associated to this key.