# `Continuum.Runtime.Context`
[🔗](https://github.com/Yyeger/Continuum/blob/main/lib/continuum/runtime/context.ex#L1)

Per-run effect context, kept in the workflow process's process dictionary.

The context holds the journal handle, the current cursor (how many events
have been replayed so far), per-callsite command ordinals, the run id, and
the lease token. It is
established by `Continuum.Runtime.Engine` before invoking the user's
`run/1` and unset on suspend or completion.

# `t`

```elixir
@type t() :: %Continuum.Runtime.Context{
  command_counts: map(),
  compensation_stack: [{term(), {module(), atom(), list()}}],
  cursor: non_neg_integer(),
  history: list(),
  history_count: non_neg_integer() | nil,
  history_index: :array.array() | nil,
  history_offset: non_neg_integer(),
  instance: Continuum.Runtime.Instance.t() | nil,
  journal: module(),
  lease_token: integer() | nil,
  run_id: binary(),
  snapshot_steps: map(),
  suspending: term() | nil,
  trace_context: binary() | nil,
  workflow_module: module()
}
```

# `active?`

Are we currently inside a workflow process?

# `clear`

Clear the context.

# `get`

Read the current context, or nil if not in a workflow process.

# `next_event`

Pop the next event from history if available; otherwise return :tail.

Advances the cursor on a successful pop.

# `put`

Set the current context for this process.

---

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