b2sdk.sync.policy
– Policy¶
-
class
b2sdk.sync.policy.
AbstractFileSyncPolicy
(source_file, source_folder, dest_file, dest_folder, now_millis, args)[source]¶ Bases:
object
Abstract policy class
-
DESTINATION_PREFIX
= NotImplemented¶
-
SOURCE_PREFIX
= NotImplemented¶
-
__init__
(source_file, source_folder, dest_file, dest_folder, now_millis, args)[source]¶ - Parameters
source_file (b2sdk.sync.file.File) – source file object
source_folder (b2sdk.sync.folder.AbstractFolder) – source folder object
dest_file (b2sdk.sync.file.File) – destination file object
dest_folder (b2sdk.sync.folder.AbstractFolder) – destination folder object
now_millis (int) – current time in milliseconds
args – an object which holds command line arguments
-
classmethod
files_are_different
(source_file, dest_file, args)[source]¶ Compare two files and determine if the the destination file should be replaced by the source file.
- Parameters
source_file (b2sdk.sync.file.File) – source file object
dest_file (b2sdk.sync.file.File) – destination file object
args – an object which holds command line arguments
- Return type
-
-
class
b2sdk.sync.policy.
DownAndDeletePolicy
(source_file, source_folder, dest_file, dest_folder, now_millis, args)[source]¶ Bases:
b2sdk.sync.policy.DownPolicy
File is synced down (from the cloud to disk) and the delete flag is SET
-
class
b2sdk.sync.policy.
DownAndKeepDaysPolicy
(source_file, source_folder, dest_file, dest_folder, now_millis, args)[source]¶ Bases:
b2sdk.sync.policy.DownPolicy
File is synced down (from the cloud to disk) and the keepDays flag is SET
-
class
b2sdk.sync.policy.
DownPolicy
(source_file, source_folder, dest_file, dest_folder, now_millis, args)[source]¶ Bases:
b2sdk.sync.policy.AbstractFileSyncPolicy
File is synced down (from the cloud to disk)
-
DESTINATION_PREFIX
= 'local://'¶
-
SOURCE_PREFIX
= 'b2://'¶
-
-
class
b2sdk.sync.policy.
UpAndDeletePolicy
(source_file, source_folder, dest_file, dest_folder, now_millis, args)[source]¶ Bases:
b2sdk.sync.policy.UpPolicy
File is synced up (from disk to the cloud) and the delete flag is SET
-
class
b2sdk.sync.policy.
UpAndKeepDaysPolicy
(source_file, source_folder, dest_file, dest_folder, now_millis, args)[source]¶ Bases:
b2sdk.sync.policy.UpPolicy
File is synced up (from disk to the cloud) and the keepDays flag is SET
-
class
b2sdk.sync.policy.
UpPolicy
(source_file, source_folder, dest_file, dest_folder, now_millis, args)[source]¶ Bases:
b2sdk.sync.policy.AbstractFileSyncPolicy
File is synced up (from disk the cloud)
-
DESTINATION_PREFIX
= 'b2://'¶
-
SOURCE_PREFIX
= 'local://'¶
-
-
b2sdk.sync.policy.
make_b2_delete_actions
(source_file, dest_file, dest_folder, transferred)[source]¶ Creates the actions to delete files stored on B2, which are not present locally.
- Parameters
source_file (b2sdk.sync.file.File) – source file object
dest_file (b2sdk.sync.file.File) – destination file object
dest_folder (b2sdk.sync.folder.AbstractFolder) – destination folder
transferred (bool) – if True, file has been transferred, False otherwise
-
b2sdk.sync.policy.
make_b2_delete_note
(version, index, transferred)[source]¶ Create a note message for delete action
-
b2sdk.sync.policy.
make_b2_keep_days_actions
(source_file, dest_file, dest_folder, transferred, keep_days, now_millis)[source]¶ Creates the actions to hide or delete existing versions of a file stored in b2.
When keepDays is set, all files that were visible any time from keepDays ago until now must be kept. If versions were uploaded 5 days ago, 15 days ago, and 25 days ago, and the keepDays is 10, only the 25-day old version can be deleted. The 15 day-old version was visible 10 days ago.
- Parameters
source_file (b2sdk.sync.file.File) – source file object
dest_file (b2sdk.sync.file.File) – destination file object
dest_folder (b2sdk.sync.folder.AbstractFolder) – destination folder object
transferred (bool) – if True, file has been transferred, False otherwise
keep_days (int) – how many days to keep a file
now_millis (int) – current time in milliseconds