Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file storage_sigs.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)(** {1 Entity Accessor Signatures} *)(** The generic signature of a single data accessor (a single value
bound to a specific key in the hierarchical (key x value)
database). *)moduletypeSingle_data_storage=sigtypettypecontext=t(** The type of the value *)typevalue(** Tells if the data is already defined *)valmem:context->boolLwt.t(** Retrieve the value from the storage bucket ; returns a
{!Storage_error} if the key is not set or if the deserialisation
fails *)valget:context->valuetzresultLwt.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 *)valget_option:context->valueoptiontzresultLwt.t(** Allocates the storage bucket and initializes it ; returns a
{!Storage_error Existing_key} if the bucket exists *)valinit:context->value->Raw_context.ttzresultLwt.t(** Updates the content of the bucket ; returns a {!Storage_Error
Missing_key} if the value does not exists *)valset:context->value->Raw_context.ttzresultLwt.t(** Allocates the data and initializes it with a value ; just
updates it if the bucket exists *)valinit_set:context->value->Raw_context.tLwt.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. *)valset_option:context->valueoption->Raw_context.tLwt.t(** Delete the storage bucket ; returns a {!Storage_error
Missing_key} if the bucket does not exists *)valdelete:context->Raw_context.ttzresultLwt.t(** Removes the storage bucket and its contents ; does nothing if
the bucket does not exists *)valremove:context->Raw_context.tLwt.tend(** Variant of {!Single_data_storage} with gas accounting. *)moduletypeSingle_carbonated_data_storage=sigtypettypecontext=t(** The type of the value *)typevalue(** Tells if the data is already defined.
Consumes [Gas_repr.read_bytes_cost Z.zero]. *)valmem:context->(Raw_context.t*bool)tzresultLwt.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>]. *)valget:context->(Raw_context.t*value)tzresultLwt.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]. *)valget_option:context->(Raw_context.t*valueoption)tzresultLwt.t(** Allocates the storage bucket and initializes it ; returns a
{!Storage_error Missing_key} if the bucket exists.
Consumes [Gas_repr.write_bytes_cost <size of the value>].
Returns the size. *)valinit:context->value->(Raw_context.t*int)tzresultLwt.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. *)valset:context->value->(Raw_context.t*int)tzresultLwt.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. *)valinit_set:context->value->(Raw_context.t*int*bool)tzresultLwt.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, and a boolean
indicating if a value was already associated to this key. *)valset_option:context->valueoption->(Raw_context.t*int*bool)tzresultLwt.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. *)valdelete:context->(Raw_context.t*int)tzresultLwt.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. *)valremove:context->(Raw_context.t*int*bool)tzresultLwt.tend(** Restricted version of {!Indexed_data_storage} w/o iterators. *)moduletypeNon_iterable_indexed_data_storage=sigtypettypecontext=t(** An abstract type for keys *)typekey(** The type of values *)typevalue(** Tells if a given key is already bound to a storage bucket *)valmem:context->key->boolLwt.t(** Retrieve a value from the storage bucket at a given key ;
returns {!Storage_error Missing_key} if the key is not set ;
returns {!Storage_error Corrupted_data} if the deserialisation
fails. *)valget:context->key->valuetzresultLwt.t(** Retrieve a value from the storage bucket at a given key ;
returns [None] if the value is not set ; returns {!Storage_error
Corrupted_data} if the deserialisation fails. *)valget_option:context->key->valueoptiontzresultLwt.t(** Updates the content of a bucket ; returns A {!Storage_Error
Missing_key} if the value does not exists. *)valset:context->key->value->Raw_context.ttzresultLwt.t(** Allocates a storage bucket at the given key and initializes it ;
returns a {!Storage_error Existing_key} if the bucket exists. *)valinit:context->key->value->Raw_context.ttzresultLwt.t(** Allocates a storage bucket at the given key and initializes it
with a value ; just updates it if the bucket exists. *)valinit_set:context->key->value->Raw_context.tLwt.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. *)valset_option:context->key->valueoption->Raw_context.tLwt.t(** Delete a storage bucket and its contents ; returns a
{!Storage_error Missing_key} if the bucket does not exists. *)valdelete:context->key->Raw_context.ttzresultLwt.t(** Removes a storage bucket and its contents ; does nothing if the
bucket does not exists. *)valremove:context->key->Raw_context.tLwt.tend(** Variant of {!Non_iterable_indexed_data_storage} with gas accounting. *)moduletypeNon_iterable_indexed_carbonated_data_storage=sigtypettypecontext=t(** An abstract type for keys *)typekey(** The type of values *)typevalue(** Tells if a given key is already bound to a storage bucket.
Consumes [Gas_repr.read_bytes_cost Z.zero]. *)valmem:context->key->(Raw_context.t*bool)tzresultLwt.t(** Retrieve a value from the storage bucket at a given key ;
returns {!Storage_error Missing_key} if the key is not set ;
returns {!Storage_error Corrupted_data} if the deserialisation
fails.
Consumes [Gas_repr.read_bytes_cost <size of the value>]. *)valget:context->key->(Raw_context.t*value)tzresultLwt.t(** Retrieve a value from the storage bucket at a given key ;
returns [None] if the value is not set ; returns {!Storage_error
Corrupted_data} if the deserialisation fails.
Consumes [Gas_repr.read_bytes_cost <size of the value>] if present
or [Gas_repr.read_bytes_cost Z.zero]. *)valget_option:context->key->(Raw_context.t*valueoption)tzresultLwt.t(** Updates the content of a bucket ; returns A {!Storage_Error
Missing_key} if the value does not exists.
Consumes serialization cost.
Consumes [Gas_repr.write_bytes_cost <size of the new value>].
Returns the difference from the old to the new size. *)valset:context->key->value->(Raw_context.t*int)tzresultLwt.t(** Allocates a storage bucket at the given key and initializes it ;
returns a {!Storage_error Existing_key} if the bucket exists.
Consumes serialization cost.
Consumes [Gas_repr.write_bytes_cost <size of the value>].
Returns the size. *)valinit:context->key->value->(Raw_context.t*int)tzresultLwt.t(** Allocates a storage bucket at the given key and initializes it
with a value ; just updates it if the bucket exists.
Consumes serialization cost.
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. *)valinit_set:context->key->value->(Raw_context.t*int*bool)tzresultLwt.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 serialization cost.
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. *)valset_option:context->key->valueoption->(Raw_context.t*int*bool)tzresultLwt.t(** Delete a storage bucket and its contents ; returns a
{!Storage_error Missing_key} if the bucket does not exists.
Consumes [Gas_repr.write_bytes_cost Z.zero].
Returns the freed size. *)valdelete:context->key->(Raw_context.t*int)tzresultLwt.t(** Removes a 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. *)valremove:context->key->(Raw_context.t*int*bool)tzresultLwt.tend(** The generic signature of indexed data accessors (a set of values
of the same type indexed by keys of the same form in the
hierarchical (key x value) database). *)moduletypeIndexed_data_storage=sigincludeNon_iterable_indexed_data_storage(** Empties all the keys and associated data. *)valclear:context->Raw_context.tLwt.t(** Lists all the keys. *)valkeys:context->keylistLwt.t(** Lists all the keys and associated data. *)valbindings:context->(key*value)listLwt.t(** Iterates over all the keys and associated data. *)valfold:context->init:'a->f:(key->value->'a->'aLwt.t)->'aLwt.t(** Iterate over all the keys. *)valfold_keys:context->init:'a->f:(key->'a->'aLwt.t)->'aLwt.tendmoduletypeIndexed_data_snapshotable_storage=sigtypesnapshottypekeyincludeIndexed_data_storagewithtypekey:=keymoduleSnapshot:Indexed_data_storagewithtypekey=(snapshot*key)andtypevalue=valueandtypet=tvalsnapshot_exists:context->snapshot->boolLwt.tvalsnapshot:context->snapshot->Raw_context.ttzresultLwt.tvaldelete_snapshot:context->snapshot->Raw_context.tLwt.tend(** The generic signature of a data set accessor (a set of values
bound to a specific key prefix in the hierarchical (key x value)
database). *)moduletypeData_set_storage=sigtypettypecontext=t(** The type of elements. *)typeelt(** Tells if a elt is a member of the set *)valmem:context->elt->boolLwt.t(** Adds a elt is a member of the set *)valadd:context->elt->Raw_context.tLwt.t(** Removes a elt of the set ; does nothing if not a member *)valdel:context->elt->Raw_context.tLwt.t(** Adds/Removes a elt of the set *)valset:context->elt->bool->Raw_context.tLwt.t(** Returns the elements of the set, deserialized in a list in no
particular order. *)valelements:context->eltlistLwt.t(** Iterates over the elements of the set. *)valfold:context->init:'a->f:(elt->'a->'aLwt.t)->'aLwt.t(** Removes all elements in the set *)valclear:context->Raw_context.tLwt.tendmoduletypeNAME=sigvalname:Raw_context.keyendmoduletypeVALUE=sigtypetvalencoding:tData_encoding.tendmoduletypeREGISTER=sigvalghost:boolendmoduletypeNon_iterable_indexed_carbonated_data_storage_with_free=sigincludeNon_iterable_indexed_carbonated_data_storage(** Only used for 005 migration to avoid gas cost.
Allocates a storage bucket at the given key and initializes it ;
returns a {!Storage_error Existing_key} if the bucket exists. *)valinit_free:context->key->value->(Raw_context.t*int)tzresultLwt.t(** Only used for 005 migration to avoid gas cost.
Updates the content of a bucket ; returns A {!Storage_Error
Missing_key} if the value does not exists. *)valset_free:context->key->value->(Raw_context.t*int)tzresultLwt.tendmoduletypeIndexed_raw_context=sigtypettypecontext=ttypekeytype'aipathvalclear:context->Raw_context.tLwt.tvalfold_keys:context->init:'a->f:(key->'a->'aLwt.t)->'aLwt.tvalkeys:context->keylistLwt.tvalresolve:context->stringlist->keylistLwt.tvalremove_rec:context->key->contextLwt.tvalcopy:context->from:key->to_:key->contexttzresultLwt.tmoduleMake_set(R:REGISTER)(N:NAME):Data_set_storagewithtypet=tandtypeelt=keymoduleMake_map(N:NAME)(V:VALUE):Indexed_data_storagewithtypet=tandtypekey=keyandtypevalue=V.tmoduleMake_carbonated_map(N:NAME)(V:VALUE):Non_iterable_indexed_carbonated_data_storage_with_freewithtypet=tandtypekey=keyandtypevalue=V.tmoduleRaw_context:Raw_context.Twithtypet=tipathend