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: str, source_path: Optional[AbstractPath], source_folder: AbstractFolder, dest_path: Optional[AbstractPath], dest_folder: AbstractFolder, now_millis: int, delete: bool, keep_days: int, newer_file_mode: NewerFileSyncMode, compare_threshold: int, compare_version_mode: CompareVersionMode, encryption_settings_provider: AbstractSyncEncryptionSettingsProvider, upload_mode: UploadMode, absolute_minimum_part_size: int) AbstractFileSyncPolicy[source]

Return a policy object.

  • sync_type – synchronization type

  • source_path – source file

  • source_folder – a source folder path

  • dest_path – destination file

  • dest_folder – a destination folder path

  • now_millis – current time in milliseconds

  • delete – delete policy

  • keep_days – keep for days policy

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

  • compare_threshold – difference between file modification time or file size

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

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

  • upload_mode – determines how file uploads are handled

  • absolute_minimum_part_size – minimum file part size for large files


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