# Module `Environment_context.Context`

`type ('ctxt, 'tree) ops`

`= (module CONTEXT with type t = 'ctxt and type tree = 'tree)`

`type _ kind`

`= private`

`..`

`type ('a, 'b) equality_witness`

`type t`

`=`

`|`

`Context :`

`{`

`kind : 'a kind;`

`impl_name : string;`

`ctxt : 'a;`

`ops : ('a, 'b) ops;`

`equality_witness : ('a, 'b) equality_witness;`

`}`

`-> t`

`include CONTEXT with type t := t`

`include Environment_context_intf.VIEW with type key = string list and type value = bytes`

### Getters

`val mem : t -> key -> bool Lwt.t`

`mem t k`

is an Lwt promise that resolves to`true`

iff`k`

is bound to a value in`t`

.

### Setters

`val add : t -> key -> value -> t Lwt.t`

`add t k v`

is an Lwt promise that resolves to`c`

such that:`k`

is bound to`v`

in`c`

;- and
`c`

is similar to`t`

otherwise.

If

`k`

was already bound in`t`

to a value that is physically equal to`v`

, the result of the function is a promise that resolves to`t`

. Otherwise, the previous binding of`k`

in`t`

disappears.

### Folding

`val fold : ?depth:[ `Eq of int | `Le of int | `Lt of int | `Ge of int | `Gt of int ] -> t -> key -> init:'a -> f:(key -> tree -> 'a -> 'a Lwt.t) -> 'a Lwt.t`

`fold ?depth t root ~init ~f`

recursively folds over the trees and values of`t`

. The`f`

callbacks are called with a key relative to`root`

.`f`

is never called with an empty key for values; i.e., folding over a value is a no-op.Elements are traversed in lexical order of keys.

The depth is 0-indexed. If

`depth`

is set (by default it is not), then`f`

is only called when the conditions described by the parameter is true:`Eq d`

folds over nodes and contents of depth exactly`d`

.`Lt d`

folds over nodes and contents of depth strictly less than`d`

.`Le d`

folds over nodes and contents of depth less than or equal to`d`

.`Gt d`

folds over nodes and contents of depth strictly more than`d`

.`Ge d`

folds over nodes and contents of depth more than or equal to`d`

.

`module Tree : sig ... end`

`val set_protocol : t -> Tezos_crypto.Protocol_hash.t -> t Lwt.t`

`val get_protocol : t -> Tezos_crypto.Protocol_hash.t Lwt.t`

`val fork_test_chain : t -> protocol:Tezos_crypto.Protocol_hash.t -> expiration:Tezos_base__TzPervasives.Time.Protocol.t -> t Lwt.t`