Skip to main content

save_session_in_dir

Function save_session_in_dir 

Source
pub fn save_session_in_dir(
    dir: &Path,
    session: &Session,
    mode: SessionPersistence,
) -> Result<SaveReceipt, Error>
Expand description

Persist session into dir under the given persistence mode.

Json (default): the unchanged legacy path — one atomic private <id>.json — plus rollback folding: any journal left over from a previous opt-in is deleted, because the fresh snapshot supersedes it.

Journal: append the delta since the last durable state; write a fresh snapshot instead when the journal is missing/unusable, the history shrank or its durable tail was edited (append-only tripwires), or the journal outgrew snapshot_due.