Module Context.PVMState

State of the PVM that this rollup node deals with

type 'access value = 'access pvmstate

The value of a PVM state

type immutable_value

Immutable representation of value. In practice these are copies of values.

val empty : 'a index -> [ `Read | `Write ] value

empty () is the empty PVM state.

val find : < state : 'a ; index : _ > t -> 'a value option Lwt.t

find context returns the PVM state stored in the context, if any.

val get : < state : 'a ; index : _ > t -> 'a value Tezos_base.TzPervasives.tzresult Lwt.t

get context is the same as find but fails if there is no PVM state stored in the context.

val lookup : _ value -> string list -> bytes option Lwt.t

lookup state path returns the data stored for the path path in the PVM state state.

val set : < state : [ `Read | `Write ] ; index : _ > t -> [ `Read | `Write ] value -> unit Lwt.t

set context state saves the PVM state state in the context and returns the updated context. Note: set does not perform any write on disk, this information must be committed using commit.

val copy : _ value -> [ `Read | `Write ] value

Copy a PVM state. WARNING: Can incur a significant memory allocation.

val imm_copy : _ value -> immutable_value

Create an immutable copy. WARNING: Can incur a significant memory allocation.

val mut_copy : immutable_value -> [ `Read | `Write ] value

Create a mutable copy. WARNING: Can incur a significant memory allocation.

val readonly : _ value -> [ `Read ] value

Returns a read-only version of the state. Does not make any copy.

val access_mode : 'a value -> 'a Access_mode.t
val maybe_readonly : 'a Access_mode.t -> [ `Read | `Write ] value -> 'a value

maybe_readone mode state returns a read-only version of state if mode is Read_only.