restore_repository()
Restores files from a snapshot to a local destination.Parameters
file_infos: The restore plan containing information about what to restorerepo: The repository to restore fromopts: Restore optionsnode_streamer: Iterator providing file/directory nodesdest: Destination directory for restored files
Errors
- If the restore operation fails
RestoreOptions
Configuration options for the restore operation.Remove all files/dirs in destination which are not contained in snapshot.
Use numeric IDs instead of user/group names when restoring uid/gid.
Don’t restore ownership (user/group). Conflicts with
numeric_id.Always read and verify existing files. Don’t trust correct modification time and file size.
RestorePlan
Contains information about what will be restored.Fields
Total size of data to restore.
Total size of matched content (already exists, no restore needed).
Detailed statistics about the restore operation.
Methods
to_packs()
Get a list of all pack files needed to perform the restore.RestoreStats
Statistics about files and directories in a restore operation.FileDirStats
Statistics for files or directories.Number of items to restore.
Number of items which are unchanged (determined by date, but not verified).
Number of items which are verified and unchanged.
Number of items which are modified.
Number of additional entries in destination.
LocalDestination
Represents a local filesystem destination for restore operations. Provides methods for:- Creating directories
- Writing file contents
- Setting file metadata (permissions, ownership, timestamps)
- Reading existing files for verification
Example
Notes
- Restore uses the modification time and file size to detect unchanged files
- Use
verify_existingto always verify file contents (slower but more thorough) - The
deleteoption removes files from destination that aren’t in the snapshot - Restore operations are optimized to skip files that haven’t changed
- Multiple reader threads (up to 20) are used for parallel restore