# `Lockstep.Trace`
[🔗](https://github.com/b-erdem/lockstep/blob/v0.1.0/lib/lockstep/trace.ex#L1)

Recorded schedule. A trace is the sequence of decisions the controller
made during a test iteration.

Each entry: `%{step: integer, event: tuple}`. Events:

    {:hello, pid}
    {:spawn, parent, child}
    {:spawn_link, parent, child}
    {:send, from, to, msg}
    {:recv, pid, msg}
    {:exit, pid, reason}
    {:link, pid, target}
    {:unlink, pid, target}
    {:flag, pid, flag, prev_value}
    {:exit_signal, dying_pid, linked_pid, reason}

PIDs are the original Erlang pids from the recording run. They are *not*
meaningful for replay across runs; instead the trace records spawn
*order* and replay reconstructs the equivalent ordering. See
`Lockstep.Strategy.Replay`.

Format on disk: a `:erlang.term_to_binary/1` of `%{version: 1, ...}`.

# `entry`

```elixir
@type entry() :: %{step: non_neg_integer(), event: tuple()}
```

# `t`

```elixir
@type t() :: [entry()]
```

# `entry`

```elixir
@spec entry(non_neg_integer(), tuple()) :: entry()
```

Build a trace entry.

# `format`

```elixir
@spec format(
  t(),
  keyword()
) :: String.t()
```

Format a trace as a human-readable schedule.

# `load`

```elixir
@spec load(Path.t()) :: %{required(atom()) =&gt; any()}
```

Load a trace file. Returns the metadata map.

# `save`

```elixir
@spec save(
  t(),
  keyword()
) :: Path.t()
```

Save trace + iteration metadata to disk. Returns the path.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
