class b2sdk.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: AbstractPath, source_folder, dest_path: AbstractPath, dest_folder, now_millis, delete, keep_days, newer_file_mode, compare_threshold, compare_version_mode, encryption_settings_provider)[source]

Return a policy object.

  • sync_type (str) – synchronization type

  • source_path (b2sdk.v2.AbstractPath) – source file

  • source_folder (str) – a source folder path

  • dest_path (b2sdk.v2.AbstractPath) – destination file

  • dest_folder (str) – 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 (b2sdk.v2.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 (b2sdk.v2.CompareVersionMode) – setting which determines how to compare source and destination files

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


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