package irmin-bench
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=92a9de7a0a2a35c2feba0c35a806b1f0df24c1c0d15164eebf3f919296d26715
sha512=0203ec5117a851ad5afeb2f9091659b4e142e231b6b945caab93f4d7beb23397c8ac43f7056e91d18f4bff0be1062f6ae966d221f877c229328c0cbbf29fd9f0
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