Skip to main content

Module steps

Module steps 

Expand description

Undo, redo, restore and checkpoints written into the document itself, so anyone who can invoke an action can use them: a person, a script, an agent over the action door.

UndoLog is the process’s own stack: it knows only what this window did, and only while it runs. The verbs here read the change graph instead, so “undo my last two steps” means the same on every replica and after a restart, and an agent run is undone by naming it. Every verb writes forward: the step being undone keeps its author, and the undo is itself a step that can be undone.

A step belongs to a Scope: an agent run (every invocation of one agent connection), else the invoking principal, else the writing actor. What a scope has undone is recorded at UNDONE_KEY root keys, one per undone change. Ordinary undo writes completion in that same change; outside compensation stays pending until its admitted receipt confirms it. A redo removes completed markers through the same selective inversion.

Structs§

Checkpoint
A named version.
ItemChange
How one item differs between two versions.
StepIndex
A document’s history read once and kept up to date: its changes in causal order and what each one was to the steps of its author. A change’s kind never changes, so it is read once; new changes are read as they arrive.

Enums§

Scope
Whose steps an undo or redo takes back.

Constants§

AGENT_RUN
The group kind of an agent connection’s invocations.
BOOKKEEPING_PREFIX
Prefix every bookkeeping root key shares; a restore leaves them alone.
CHECKPOINT_KEY
Prefix of the root keys holding named versions.
MAX_CHECKPOINT_NAME
Longest checkpoint name.
MAX_RESTORE_PATHS
Maximum number of exact paths accepted by restore_paths.
MAX_RESTORE_PATH_BYTES
Maximum byte length of one exact restore path.
UNDONE_KEY
The document key prefix of a step’s undo marker, followed by the step’s change hash: true once taken back, a negative attempt count while its undo waits for an outside consequence to settle, a positive one while its redo does.

Functions§

brought_back
What one redo change brought back, by full hash; empty for any other change.
changed_items
The items that differ between from and to, in document order, bookkeeping left out.
checkpoint
Name the document’s current version name; naming another version with a name in use moves the name.
checkpoints
Every checkpoint, by name.
gesture_of
The step a change recorded it belongs to.
is_bookkeeping
Whether patch writes bookkeeping rather than content.
is_schema_genesis
Whether version is the schema genesis rather than something a person wrote. See [is_schema_genesis_actor].
pending_compensations
Recorded outside inverses which have not confirmed completion. This is descriptive history data; callers must verify the original action too.
redo
Bring back the last limit undos of scope, as one new change: an outside step through the action restore gives for it (its recorded action, run again), any other by reverting the undo. A positive pending marker keeps such a step undone until its restoration settles. Returns the undo changes it brought back, newest first.
resolve
The heads version names: a checkpoint’s name, or a change id from history (at least six hex digits of it) — the document as of that change.
restore
Bring the document back to heads as one new change: all of it, or only the items whose keys are ids (a mark, a layer, a field). Bookkeeping — what is undone, the checkpoints — stays as it is. Returns how many patches were written.
restore_paths
Restore only the exact paths listed by changed_items, writing forward through the same patch machinery as restore. A root path selects its entire value (including every descendant); map/id selects only that entry. Unlike restore, an empty selection never means the whole document.
short
The first twelve hex digits of a change hash: what history lists.
step_label
A one-line name of a step for a sentence.
steps_in_effect
took_back
What one undo change took back, by full hash; empty for any other change.
undo
Take back scope’s last limit steps that are in effect, as one new change in doc’s open transaction: each through the inverse compensate gives for it, else by reverting its patches. Returns the steps, newest first. On a refusal some of it may already be written: the caller discards the transaction, as the action executor does for a refused action.
undo_preview
What undo would take back for scope now: its last limit steps in effect, newest first.
undo_since
Take back every step of scope’s in effect made after the version heads, as one new change: back to a checkpoint or a change from history without counting steps. Returns the steps, newest first.
undone
The changes currently undone, by full hash.
undos_in_effect
The undos in effect that owns claims, newest first, at most limit (see StepIndex::undos).

Type Aliases§

Inverse
The verified inverse action of a step, when it has one (it queued an outside consequence): applied instead of reverting its patches. Supplied by the caller’s registry; it carries no authority of its own.