Module Mavryk_protocol_environment.Proxy_context

This module is the location where the proxy tweaks the behavior of a vanilla client. A regular mockup client uses a Memory_context in place of this implementation. Compared to Memory_context, this instance features a Proxy_Delegate.T which under the hood relies on Proxy_getter.

Other *_context modules of Mavryk_protocol_environment, i.e. siblings of this file, are backed by different type of values coming from Mavryk_context. This file is backed by M.t below, which is a thin layer over Mavryk_memory_context.Context. Because of that, this instance of Mavryk_protocol_environment is close to the Memory_context one.

Whereas Memory_context is a regular recursive map, Proxy_context obtains values by delegating to endpoints when receiving requests. Hence, right after having created an empty value with an instance of Proxy_Delegate.T, this value behaves as the distant endpoint it delegates to.

module M : sig ... end

The module by which to parameterize Environment_context.Context.kind below.

type Mavryk_protocol_environment__.Environment_context.Context.kind +=
  1. | Context : M.t Mavryk_protocol_environment__.Environment_context.Context.kind

The additional kind identifying Proxy_context values. Used to detect at runtime when a proxy context is expected, to disambiguate from other kinds.

val empty : Proxy_delegate.t option -> Mavryk_protocol_environment__.Environment_context.Context.t

Constructs an empty context, possibly giving the delegate (the function querying the endpoint) right away. Otherwise set it later with set delegate