package irmin-bench
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=09996fbcc2c43e117a9bd8e9028c635e81cccb264d5e02d425ab8b06bbacdbdb
sha512=0391a6bf7b94a1edd50a3a8df9e58961739fa78d7d689d61f56bc87144483bad2ee539df595c33d9d52c29b3458da5dddf3a73b5eb85e49c4667c26d2cd46be1
doc/irmin-bench.traces/Irmin_traces/Trace_definitions/Replayable_trace/index.html
Module Trace_definitions.Replayable_trace
Source
Replayable_trace
, a trace of Tezos's interactions with Irmin.
Interleaved Contexts and Commits
All the recorded operations in Tezos operate on (and create new) immutable records of type context
. Most of the time, everything is linear (i.e. the input context to an operation is the latest output context), but there sometimes are several parallel chains of contexts, where all but one will end up being discarded.
Similarly to contexts, commits are not always linear, i.e. a checkout may choose a parent that is not the latest commit.
To solve this conundrum when replaying the trace, we need to remember all the context_id -> tree
and trace commit hash -> real commit hash
pairs to make sure an operation is operating on the right parent.
In the trace, the context indices and the commit hashes are 'scoped', meaning that they are tagged with a boolean information indicating if this is the very last occurence of that value in the trace. This way we can discard a recorded pair as soon as possible.
In practice, there is only 1 context and 1 commit in history, and sometimes 0 or 2, but the code is ready for more.
include module type of struct include Latest end
type add = V0.add = {
key : key;
value : string;
in_ctx_id : context_id scope;
out_ctx_id : context_id scope;
}
type copy = V0.copy = {
key_src : key;
key_dst : key;
in_ctx_id : context_id scope;
out_ctx_id : context_id scope;
}
type row = V0.row =
| Checkout of hash scope * context_id scope
| Add of add
| Remove of key * context_id scope * context_id scope
| Copy of copy
| Find of key * bool * context_id scope
| Mem of key * bool * context_id scope
| Mem_tree of key * bool * context_id scope
| Commit of commit
include sig ... end
val decoded_seq_of_encoded_chan_with_prefixes :
'a Repr.ty ->
in_channel ->
unit ->
'a Seq.node