package tezos-protocol-004-Pt24m4xi
Variant of Single_data_storage
with gas accounting.
type context = t
val mem :
context ->
(Raw_context.t * bool)
Tezos_protocol_environment_004_Pt24m4xi.Error_monad.tzresult
Tezos_protocol_environment_004_Pt24m4xi.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_004_Pt24m4xi.Error_monad.tzresult
Tezos_protocol_environment_004_Pt24m4xi.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_004_Pt24m4xi.Error_monad.tzresult
Tezos_protocol_environment_004_Pt24m4xi.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_004_Pt24m4xi.Error_monad.tzresult
Tezos_protocol_environment_004_Pt24m4xi.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_004_Pt24m4xi.Error_monad.tzresult
Tezos_protocol_environment_004_Pt24m4xi.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)
Tezos_protocol_environment_004_Pt24m4xi.Error_monad.tzresult
Tezos_protocol_environment_004_Pt24m4xi.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.
val set_option :
context ->
value option ->
(Raw_context.t * int)
Tezos_protocol_environment_004_Pt24m4xi.Error_monad.tzresult
Tezos_protocol_environment_004_Pt24m4xi.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 valus 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.
val delete :
context ->
(Raw_context.t * int)
Tezos_protocol_environment_004_Pt24m4xi.Error_monad.tzresult
Tezos_protocol_environment_004_Pt24m4xi.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)
Tezos_protocol_environment_004_Pt24m4xi.Error_monad.tzresult
Tezos_protocol_environment_004_Pt24m4xi.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.