pub fn backup_database(
dir: &Path,
dest: &Path,
options: &BackupOptions,
) -> Result<BackupResult, DatabaseError>Expand description
Copies a database directory into dest: the files the database accounts for (see
[owned_files]) plus a hayson-backup.json manifest listing them with their sizes.
dest must not exist or must be an empty directory. The copy is built next to it and renamed
into place, so a backup that fails halfway leaves no half-filled dest. The directory is held
under the writer lock for the length of the copy unless options.lock is LockMode::Skip;
a database with an unfinished unit of work is refused, because its log and journal disagree
until a writable open finishes it.
History kept in a database of its own is not part of this database’s files, so it is not copied.