pub fn restore_database(
backup: &Path,
dir: &Path,
options: &RestoreOptions,
) -> Result<RestoreResult, DatabaseError>Expand description
Restores a backup made by backup_database into dir, replacing the database that is there.
Recoverable: nothing is deleted until the replacement is in place. The backup is copied into
<dir>/.restore-new and checked (sizes against the manifest, then verify with no error);
the files of the database being replaced are moved into <dir>/.restore-old; the new files are
moved in; and only then is .restore-old removed. If a move fails, the files already moved are
put back, and when even that fails both errors are reported. A .restore-old left by an
interrupted restore is refused, because it may hold the only good copy.
Only the files the database accounts for are replaced, so another database living in a
subfolder of dir is untouched.