package irmin-bench

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Trace_definitions.Replayable_traceSource

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.

Sourcemodule V0 : sig ... end
Sourcemodule Latest = V0
include module type of struct include Latest end
Sourceval version : int
Sourcetype header = unit
Sourceval header_t : unit Repr.t
Sourcetype 'a scope = 'a V0.scope =
  1. | Forget of 'a
  2. | Keep of 'a
Sourceval scope_t : 'a Repr.t -> 'a scope Repr.t
Sourcetype key = string list
Sourceval key_t : string list Repr.t
Sourcetype hash = string
Sourceval hash_t : string Repr.t
Sourcetype message = string
Sourceval message_t : string Repr.t
Sourcetype context_id = int64
Sourceval context_id_t : int64 Repr.t
Sourcetype add = V0.add = {
  1. key : key;
  2. value : string;
  3. in_ctx_id : context_id scope;
  4. out_ctx_id : context_id scope;
}
Sourceval add_t : add Repr.t
Sourcetype copy = V0.copy = {
  1. key_src : key;
  2. key_dst : key;
  3. in_ctx_id : context_id scope;
  4. out_ctx_id : context_id scope;
}
Sourceval copy_t : copy Repr.t
Sourcetype commit = V0.commit = {
  1. hash : hash scope;
  2. date : int64;
  3. message : message;
  4. parents : hash scope list;
  5. in_ctx_id : context_id scope;
}
Sourceval commit_t : commit Repr.t
Sourcetype row = V0.row =
  1. | Checkout of hash scope * context_id scope
  2. | Add of add
  3. | Remove of key * context_id scope * context_id scope
  4. | Copy of copy
  5. | Find of key * bool * context_id scope
  6. | Mem of key * bool * context_id scope
  7. | Mem_tree of key * bool * context_id scope
  8. | Commit of commit
Sourceval row_t : row Repr.t
include sig ... end
Sourceval decode_i32 : int32 Repr.decode_bin
Sourceval encode_i32 : int32 Repr.encode_bin
Sourceval encode_lheader : unit Repr.encode_bin
Sourceval encode_lrow : V0.row Repr.encode_bin
Sourceval magic : Irmin_traces__Trace_common.Magic.t
Sourceval read_with_prefix_exn : (string -> int ref -> 'a) -> in_channel -> 'a
Sourceval decoded_seq_of_encoded_chan_with_prefixes : 'a Repr.ty -> in_channel -> unit -> 'a Seq.node
Sourceval open_reader : string -> unit * (unit -> V0.row Seq.node)
Sourcetype writer = {
  1. path : string;
  2. channel : out_channel;
  3. buffer : Buffer.t;
}
Sourceval create_file : string -> unit -> writer
Sourceval append_row : writer -> V0.row -> unit
Sourceval flush : writer -> unit
Sourceval close : writer -> unit
Sourceval remove : writer -> unit
OCaml

Innovation. Community. Security.