Skip to main content

restore_backup

Function restore_backup 

Source
pub fn restore_backup<T: LinkReference, S: TransitionLogStore, D: TransitionLogStore>(
    source: &mut S,
    destination: &mut D,
    revision: Option<u64>,
) -> Result<u64, LinkError>
Expand description

Copy an archived journal to an empty log, stopping at one revision, and return the revision the copy ends at. None copies the whole archive. Opening the destination gives the engine as it was at that revision, on a new timeline.

Records are copied unchanged, so an incremental chain restores to any revision it holds, and so does a live journal. Records after the selected revision are not decoded, so a copy can end just before damage. Everything up to it is decoded before the first write, so a refused restore leaves the destination unchanged. After a later failure the destination may hold a shorter copy, so discard it. See docs/ENGINE-BACKUP.md.