main module¶
Backshift: A deduplicating backup script with expiration.
- class main.Progress_report(type_)[source]¶
Bases:
object
A class for describing what kind of progress report to give during a backup.
- main.absolutize(directory_at_outset, filename)[source]¶
Make a filename absolute.
If filename is relative, make it absolute relative to the CWD when the program was started, as indicated by directory_at_outset
- main.ascii_ize(binary)[source]¶
Replace non-ASCII characters with question marks; otherwise writing to sys.stdout tracebacks.
- main.backup_full_poststat_stats(filelist, repo, directory_at_outset)[source]¶
Do a backup - assume find lists filenames only - we add the sizes.
- main.backup_full_prestat_stats(filelist, repo, directory_at_outset)[source]¶
Do a backup - assume find has prefixed filenames with sizes separated by a space.
- main.backup_full_progress_report(filelist, repo, directory_at_outset, get_records)[source]¶
Produce a backup. Inhale the filenames, and give a percent complete as we go.
We treat bytes in a file as bytes in a file, and metadata is always assumed metadata_size bytes.
- main.backup_minimal_stats(filelist, repo, directory_at_outset)[source]¶
Produce a backup. Don’t inhale the filenames, and don’t give a percent complete as we go.
- main.backup_moderate_stats(filelist, repo, directory_at_outset)[source]¶
Create a backup with moderate progress output.
Inhale the filenames, and give a percent complete by bytes as we go. We pretend every byte takes the same amount of time.
- main.backup_no_stats(filelist, repo, directory_at_outset)[source]¶
Produce a backup. Don’t inhale the filenames, and don’t give a percent complete as we go.
- main.get_full_poststat_progress_recs(filelist, repo, directory_at_outset)[source]¶
Produce a backup with poststat progress.
Read the records for a full+poststat progress report. Use stat to compute file sizes before we start backing anything up.
- main.get_full_prestat_progress_recs(filelist, repo, directory_at_outset)[source]¶
Read the records for a full+prestat progress report. Assume we’ll get sizeblankfilename0 on each line of input.
- main.handle_savedir(save_directory, init_savedir)[source]¶
Maybe create savedir, maybe error about savedir - depending on init-savedir.
We only create it if it doesn’t yet exist, and init_savedir is True.
- main.main()[source]¶
Operations available follow.
perform a backup
restore a backup
list backups available
list files within a backup
or expire old files.
- main.output_filename(filename, add_eol=True)[source]¶
Output a filename to the tty (stdout), taking into account that some tty’s do not allow non-ASCII characters.
- main.perform_expire(starting_directory, check_hashes)[source]¶
Expire old chunks and savesets from a repository.
- main.perform_get_metadata(repo, backup_id, save_directory, filename)[source]¶
Output one file’s metadata to stdout.
- main.perform_list_backup(repo, backup_id, starting_directory, recursive=True)[source]¶
List all files within a backup along the lines of ‘tar tvf’.
- main.perform_list_backup_simply(repo, backup_id, starting_directory, recursive=True)[source]¶
List all files within a backup along the lines of ‘tar tf’.
- main.produce_tar(repo, backup_id, starting_directory, recursive=True, tar_format='default')[source]¶
Dump content in tar format for restoration or offsite backup.