class b2sdk._internal.sync.policy_manager.SyncPolicyManager[source]

Bases: object

Policy manager; implement a logic to get a correct policy class and create a policy object based on various parameters.

get_policy(sync_type, source_path, source_folder, dest_path, dest_folder, now_millis, delete, keep_days, newer_file_mode, compare_threshold, compare_version_mode, encryption_settings_provider, upload_mode, absolute_minimum_part_size)[source]

Return a policy object.

  • sync_type (str) – synchronization type

  • source_path (Optional[AbstractPath]) – source file

  • source_folder (AbstractFolder) – a source folder path

  • dest_path (Optional[AbstractPath]) – destination file

  • dest_folder (AbstractFolder) – a destination folder path

  • now_millis (int) – current time in milliseconds

  • delete (bool) – delete policy

  • keep_days (int) – keep for days policy

  • newer_file_mode (NewerFileSyncMode) – setting which determines handling for destination files newer than on the source

  • compare_threshold (int) – difference between file modification time or file size

  • compare_version_mode (CompareVersionMode) – setting which determines how to compare source and destination files

  • encryption_settings_provider (AbstractSyncEncryptionSettingsProvider) – an object which decides which encryption to use (if any)

  • upload_mode (UploadMode) – determines how file uploads are handled

  • absolute_minimum_part_size (int) – minimum file part size for large files

Return type:



a policy object

get_policy_class(sync_type, delete, keep_days)[source]

Get policy class by a given sync type.

  • sync_type (str) – synchronization type

  • delete (bool) – if True, delete files and update from source

  • keep_days (int) – keep for keep_days before delete


a policy class