StateReconstructor

Deprecated

KeyframedReconstructor answers the same question and keeps keyframes, so stepping through a long session does not replay it from the start each time.

Replace with

import io.github.syrou.reaktiv.introspection.protocol.KeyframedReconstructor
KeyframedReconstructor(initialStateJson, actions).stateAt(index)

Reconstructs full state from an initial state snapshot and sequential module-level deltas.

Each action captures only the changed module's state (a delta). Full state at any point can be reconstructed by starting from the initial state and applying deltas sequentially.

Usage:

val fullState = StateReconstructor.applyDelta(currentStateJson, "CounterModule", deltaJson)
val stateAtIndex = StateReconstructor.reconstructAtIndex(initialStateJson, actions, 5)

Functions

Link copied to clipboard
fun applyDelta(currentStateJson: String, action: CapturedAction): String

Applies a single module delta to the current full state JSON.

fun applyDelta(currentStateJson: String, moduleName: String, deltaJson: String): String
Link copied to clipboard
fun reconstructAtIndex(initialStateJson: String, actions: List<CapturedAction>, index: Int): String

Reconstructs the full state at a given action index by applying all deltas from index 0 through the given index onto the initial state.