Mavryk_layer2_store.Delayed_write_monadType to encapsulate values with a callback that should write to disk. This allows to delay some writes to a location where we have write access to the context.
val no_write : 'a -> ('a, _) tno_write v returns v together with a write function that does nothing.
val delay_write :
'a ->
('store -> unit Mavryk_base.TzPervasives.tzresult Lwt.t) ->
('a, 'store) tdelay_write v write returns a delayed write version of v with the write function to be called later.
map f dw returns the delayed write dw where f is applied to the encapsulated value.
val map_es :
('a -> ('b, 'c) Stdlib.result Lwt.t) ->
('a, 'store) t ->
(('b, 'store) t, 'c) Stdlib.result Lwt.tmap_es is like map in the Lwt result monad.
bind f dw returns a delayed write value where f is applied to the encapsulated value and the write effects of f are added to the effects of dw.
val apply :
'store ->
('a, 'store) t ->
'a Mavryk_base.TzPervasives.tzresult Lwt.tapply node_ctxt dw applies the write effects on the context node_ctxt and returns the encapsulated value.
val ignore : ('a, _) t -> 'aignore dw ignores the write effects and returns the encapsulated value.
module Lwt_result_syntax : sig ... end