package tezos-protocol-013-PtJakart
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=43723d096307603703a1a89ed1b2eb202b365f5e7824b96b0cbf813b343a6cf7
sha512=b2a637f2e965000d3d49ad85277ca24d6cb07a1a7cf2bc69d296d8b03ad78c3eaa8e21e94b9162e62c2e11649cd03bc845b2a3dafe623b91065df69d47dc8e4f
doc/tezos-protocol-013-PtJakart.raw/Tezos_raw_protocol_013_PtJakart/Carbonated_map/Make/index.html
Module Carbonated_map.MakeSource
A functor for building gas metered maps.
Parameters
module O : COMPARABLESignature
singleton k v returns a map with a single key k and value v pair.
val find :
Alpha_context.context ->
O.t ->
'a t ->
('a option * Alpha_context.context)
Tezos_protocol_environment_013_PtJakart.Error_monad.tzresultfind ctxt k m looks up the value with key k in the given map m and also consumes the gas associated with the lookup. The complexity is logarithmic in the size of the map.
val update :
Alpha_context.context ->
O.t ->
(Alpha_context.context ->
'a option ->
('a option * Alpha_context.context)
Tezos_protocol_environment_013_PtJakart.Error_monad.tzresult) ->
'a t ->
('a t * Alpha_context.context)
Tezos_protocol_environment_013_PtJakart.Error_monad.tzresultupdate ctxt k f map updates or adds the value of the key k using f. The function accounts for the gas cost for finding the element. The updating function f should also account for its own gas cost. The complexity is logarithmic in the size of the map.
val to_list :
Alpha_context.context ->
'a t ->
((O.t * 'a) list * Alpha_context.context)
Tezos_protocol_environment_013_PtJakart.Error_monad.tzresultto_list m transforms a map m into a list. It also accounts for the gas cost for traversing the elements. The complexity is linear in the size of the map.
val of_list :
Alpha_context.context ->
merge_overlap:
(Alpha_context.context ->
'a ->
'a ->
('a * Alpha_context.context)
Tezos_protocol_environment_013_PtJakart.Error_monad.tzresult) ->
(O.t * 'a) list ->
('a t * Alpha_context.context)
Tezos_protocol_environment_013_PtJakart.Error_monad.tzresultof_list ctxt ~merge_overlaps m creates a map from a list of key-value pairs. In case there are overlapping keys, their values are combined using the merge_overlap function. The function accounts for gas for traversing the elements. merge_overlap should account for its own gas cost. The complexity is n * log n in the size of the list.
val merge :
Alpha_context.context ->
merge_overlap:
(Alpha_context.context ->
'a ->
'a ->
('a * Alpha_context.context)
Tezos_protocol_environment_013_PtJakart.Error_monad.tzresult) ->
'a t ->
'a t ->
('a t * Alpha_context.context)
Tezos_protocol_environment_013_PtJakart.Error_monad.tzresultmerge ctxt ~merge_overlap m1 m2 merges the maps m1 and m2. In case there are overlapping keys, their values are combined using the merge_overlap function. Gas costs for traversing all elements from both maps are accounted for. merge_overlap should account for its own gas cost. The complexity is n * log n, where n is size m1 + size m2.
val map :
Alpha_context.context ->
(Alpha_context.context ->
O.t ->
'a ->
('b * Alpha_context.context)
Tezos_protocol_environment_013_PtJakart.Error_monad.tzresult) ->
'a t ->
('b t * Alpha_context.context)
Tezos_protocol_environment_013_PtJakart.Error_monad.tzresultmap ctxt f m maps over all key-value pairs in the map m using the function f. It accounts for gas costs associated with traversing the elements. The mapping function f should also account for its own gas cost. The complexity is linear in the size of the map m.
val fold :
Alpha_context.context ->
(Alpha_context.context ->
'state ->
O.t ->
'value ->
('state * Alpha_context.context)
Tezos_protocol_environment_013_PtJakart.Error_monad.tzresult) ->
'state ->
'value t ->
('state * Alpha_context.context)
Tezos_protocol_environment_013_PtJakart.Error_monad.tzresultfold ctxt f z m folds over the key-value pairs of the given map m, accumulating values using f, with z as the initial state. The function f must account for its own gas cost. The complexity is linear in the size of the map m.