Freezer rsync incremental engine
freezer.engine.rsync.rsync.
RsyncEngine
(compression, symlinks, exclude, storage, max_segment_size, encrypt_key=None, dry_run=False, **kwargs)¶Bases: freezer.engine.engine.BackupEngine
backup_data
(backup_resource, manifest_path)¶Execute backup using rsync algorithm.
If an existing rsync meta data is available the backup will be incremental, otherwise will be executed a level 0 backup
backup_resource –
manifest_path –
compute_checksums
(rel_path, files_meta, reg_file=True)¶compute_incrementals
(rel_path, inode_str_struct, inode_dict_struct, files_meta, old_fs_meta_struct, write_queue, deleted=False)¶gen_file_header
(file_path, inode_str_struct)¶Generate file header for rsync binary data file
file_path – file path
inode_str_struct – file binary string including inode data
chunk of binary data to be processed on the next iteration
gen_struct_for_deleted_files
(files_meta, old_fs_meta_struct, rel_path, write_queue)¶get_file_struct
(fs_path, new_level=False)¶Generate file meta data from file abs path.
Return the meta data as a dict structure and a binary string
fs_path – file abs path
new_level –
file data structure
get_file_type
(file_mode, fs_path)¶Extract file type from the file mode retrieved from file abs path
file_mode –
fs_path –
get_fs_meta_struct
(fs_meta_path)¶get_old_file_meta
(old_fs_meta_struct, rel_path)¶get_sign_delta
(fs_path, manifest_path, write_queue)¶Compute the file or fs tree path signatures.
fs_path –
manifest_path –
write_queue –
is_file_modified
(old_file_meta, file_meta)¶Check for changes on inode or file data
old_file_meta – meta data of the previous backup execution
file_meta – meta data of the current backup execution
True if the file changed, False otherwise
is_reg_file
(file_type)¶make_files
(header_list, restore_abs_path, read_pipe, data_chunk, flushed, current_backup_level)¶Header list binary structure:
header_len, file_abs_path, RSYNC_DATA_STRUCT_VERSION, file_mode, os_stat.st_uid, os_stat.st_gid, os_stat.st_size, mtime, ctime, uname, gname, file_type, linkname, rsync_block_size,
header_list –
restore_abs_path –
read_pipe –
data_chunk –
flushed –
current_backup_level –
make_reg_file
(size, file_path, read_pipe, data_chunk, flushed, level_id)¶Create the regular file and write data on it.
size –
file_path –
read_pipe –
data_chunk –
flushed –
level_id –
metadata
(*args)¶name
¶str
Engine name
process_backup_data
(data, do_compress=True)¶Compresses and encrypts provided data according to args
process_file
(file_path, fs_path, files_meta, old_fs_meta_struct, write_queue)¶process_restore_data
(data)¶Decrypts and decompresses provided data according to args
restore_level
(restore_resource, read_pipe, backup, except_queue)¶Restore the provided file into restore_abs_path.
Decrypt the file if backup_opt_dict.encrypt_pass_file key is provided. Freezer rsync header data structure:
header_len, RSYNC_DATA_STRUCT_VERSION, file_mode, os_stat.st_uid, os_stat.st_gid, os_stat.st_size, mtime, ctime, uname, gname, file_type, linkname
restore_resource –
read_pipe –
backup –
except_queue –
rsync_gen_delta
(file_path_fd, old_file_meta)¶Get rsync delta for file descriptor provided as arg.
file_path_fd –
old_file_meta –
set_inode
(uname, gname, mtime, name)¶Set the file inode fields according to the provided args.
uname –
gname –
mtime –
name –
write_changes_in_file
(fd_curr_file, data_chunk, read_pipe)¶write_file
(file_fd, size, data_chunk, read_pipe, flushed)¶Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.