load_snapshot

Function load_snapshot 

Source
pub async fn load_snapshot(
    state: &AppState,
    ref_id: Uuid,
    snapshot_id: i32,
    doc_handle: &DocHandle,
) -> Result<(), AppError>
Expand description

Set a live Automerge document to a different snapshot’s state.

The document is updated in-place: the target snapshot’s state is read from the Automerge history via its stored heads, then applied as new operations (delete all root keys + repopulate). The doc_id is unchanged so connected clients receive the update via normal Automerge sync.

The caller is responsible for suppressing autosave (the snapshot actor does this via its skip_changes counter).