specifing max vol size in mb and only for backup creation
authorEduardo Robles Elvira <edulix@wadobo.com>
Thu, 25 Jul 2013 15:52:50 +0000 (17:52 +0200)
committerEduardo Robles Elvira <edulix@wadobo.com>
Thu, 25 Jul 2013 15:53:11 +0000 (17:53 +0200)
docs/design.py

index fd08f87..331eef0 100644 (file)
@@ -56,10 +56,10 @@ class DeltaTar(object):
     Backup class used to create backups
     '''
 
-    def __init__(self, excluded_files=[], max_volume_size,
-                 included_files=[], filter_func=None, mode="tar",
-                 password=None, logger=None, index_encrypted=True,
-                 index_name_func=None, volume_name_func=None):
+    def __init__(self, excluded_files=[], included_files=[],
+                 filter_func=None, mode="tar", password=None, logger=None,
+                 index_encrypted=True, index_name_func=None,
+                 volume_name_func=None):
         '''
         Constructor. Configures the diff engine.
 
@@ -97,7 +97,8 @@ class DeltaTar(object):
         '''
         pass
 
-    def create_full_backup(self, source_path, backup_path):
+    def create_full_backup(self, source_path, backup_path,
+                           max_volume_size=None):
         '''
         Creates a full backup.
 
@@ -105,10 +106,13 @@ class DeltaTar(object):
         - source_path: source path to the directory to back up.
         - backup_path: path where the back up will be stored. Backup path will
           be created if not existent.
+        - max_volume_size: maximum volume size. Used to split the backup in
+          volumes. Optional (won't split in volumes by default).
         '''
         pass
 
-    def create_diff_backup(self, source_path, backup_path, previous_index_path):
+    def create_diff_backup(self, source_path, backup_path, previous_index_path,
+                           max_volume_size=None):
         '''
         Creates a backup.
 
@@ -118,10 +122,13 @@ class DeltaTar(object):
           be created if not existent.
         - previous_index_path: index of the previous backup, needed to know
           which files changed since then.
+        - max_volume_size: maximum volume size in megabytes (MB). Used to split
+          the backup in volumes. Optional (won't split in volumes by default).
         '''
         pass
 
-    def restore_backup(self, target_path, backup_indexes_paths=[], backup_tar_path=None):
+    def restore_backup(self, target_path, backup_indexes_paths=[],
+                       backup_tar_path=None):
         '''
         Restores a backup.
 
@@ -171,7 +178,7 @@ class TestDeltaTar(UnitTest):
         deltatar = DeltaTar(
             # these options are the same as in tarfile:
             mode="tar#gz.aes128",
-            max_volume_size=100*1024*1024, # 100MB
+            max_volume_size=100, # 100MB
             index_name_func=index_name_func, # optional
             volume_name_func=volume_name_func # optional
         )