package octez-shell-libs
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65
doc/octez-shell-libs.shell-context/Tezos_shell_context/Shell_context/index.html
Module Tezos_shell_context.Shell_contextSource
Shell_context is a persisting recursive map backed by an on-disk Irmin tree, i.e. Tezos_context.Context (in src/lib_context), used by nodes. It is the "main" kind of context. It abstracts away Tezos_context.Context, by hiding the internals, and making it an instance of the generic Protocol_environment.Context.t. Other *_context modules of Tezos_protocol_environment, i.e. siblings of this file, are backed by different type of values coming from Tezos_context.
Shell_context is one of the instances of Environment_context along Memory_context and Proxy_context. All these 3 instances can implement the same API (i.e. Environment_context), because this API is highly polymorphic, thanks to Environment_context.Context.ops.
As such, a Shell_context value is an instance of Environment_context whose kind is the one declared in this file.
Instances of Shell_context are harder to obtain than Memory_context ones, because they require a dedicated folder on disk (the subdirectory context of the node's --data-dir when it runs). As such, instances of Shell_context are harder to initialize and use than Memory_context; making them less amenable to testing for example.
type Tezos_protocol_environment.Context.kind += | Context : Tezos_context.Context.t Tezos_protocol_environment.Context.kind
The additional kind identifying Shell_context values. Used to detect at runtime when a shell context is expected, to disambiguate from other kinds.
val checkout :
Tezos_context.Context.index ->
Tezos_base.TzPervasives.Context_hash.t ->
Tezos_protocol_environment.Context.t option Lwt.tcheckout index ctxt_hash checks whether the underlying data on disk contain an entry for ctxt_hash. If so, it is returned; otherwise Nothing is returned.
val checkout_exn :
Tezos_context.Context.index ->
Tezos_base.TzPervasives.Context_hash.t ->
Tezos_protocol_environment.Context.t Lwt.tcheckout_exn index ctxt_hash checks whether the underlying data on disk contain an entry for ctxt_hash. If so, the data are loaded and returned; otherwise the exception thrown by Tezos_context.Context.checkout_exn is forwarded. Prefer using checkout.
wrap_disk_context t creates a shell context from an Irmin on-disk folder (i.e. Tezos_context.Context.t). This function hereby abstracts away a value, from the low-level lib_context to the higher-level lib_protocol_environment.
unwrap_disk_context t gives access to the lower-level Tezos_context.Context.t value underlying a Shell_context.