b2sdk.sync.policy_manager

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.

__init__()[source]

Initialize self. See help(type(self)) for accurate signature.

get_policy(sync_type, source_file, source_folder, dest_file, dest_folder, now_millis, delete, keep_days, newer_file_mode, compare_threshold, compare_version_mode)[source]

Return a policy object.

Parameters
  • sync_type (str) – synchronization type

  • source_file (str) – source file name

  • source_folder (str) – a source folder path

  • dest_file (str) – destination file name

  • 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.v1.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.v1.CompareVersionMode) – setting which determines how to compare source and destination files

Returns

a policy object

get_policy_class(sync_type, delete, keep_days)[source]

Get policy class by a given sync type.

Parameters
  • sync_type (str) – synchronization type

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

  • keep_days (int) – keep for keep_days before delete

Returns

a policy class