b2sdk._internal.sync.action
- class b2sdk._internal.sync.action.AbstractAction[source]
Bases:
object
An action to take, such as uploading, downloading, or deleting a file. Multi-threaded tasks create a sequence of Actions which are then run by a pool of threads.
An action can depend on other actions completing. An example of this is making sure a CreateBucketAction happens before an UploadFileAction.
- run(bucket, reporter, dry_run=False)[source]
Main action routine.
- Parameters:
bucket (b2sdk._internal.bucket.Bucket) – a Bucket object
reporter (
ProgressReport
) – a place to report errorsdry_run (bool) – if True, perform a dry run
- class b2sdk._internal.sync.action.B2UploadAction(local_full_path, relative_name, b2_file_name, mod_time_millis, size, encryption_settings_provider)[source]
Bases:
AbstractAction
File uploading action.
- Parameters:
- __init__(local_full_path, relative_name, b2_file_name, mod_time_millis, size, encryption_settings_provider)[source]
- Parameters:
local_full_path (
str
) – a local file pathrelative_name (
str
) – a relative file nameb2_file_name (
str
) – a name of a new remote filemod_time_millis (
int
) – file modification time in millisecondssize (
int
) – a file sizeencryption_settings_provider (
AbstractSyncEncryptionSettingsProvider
) – encryption setting provider
- class b2sdk._internal.sync.action.B2IncrementalUploadAction(local_full_path, relative_name, b2_file_name, mod_time_millis, size, encryption_settings_provider, file_version=None, absolute_minimum_part_size=None)[source]
Bases:
B2UploadAction
- Parameters:
- __init__(local_full_path, relative_name, b2_file_name, mod_time_millis, size, encryption_settings_provider, file_version=None, absolute_minimum_part_size=None)[source]
- Parameters:
local_full_path (
str
) – a local file pathrelative_name (
str
) – a relative file nameb2_file_name (
str
) – a name of a new remote filemod_time_millis (
int
) – file modification time in millisecondssize (
int
) – a file sizeencryption_settings_provider (
AbstractSyncEncryptionSettingsProvider
) – encryption setting providerfile_version (
Optional
[FileVersion
]) – version of file currently on the serverabsolute_minimum_part_size (
Optional
[int
]) – minimum file part size for large files
- class b2sdk._internal.sync.action.B2HideAction(relative_name, b2_file_name)[source]
Bases:
AbstractAction
- do_action(bucket, reporter)[source]
Perform the hiding action, returning only after the action is completed.
- Parameters:
bucket (
Bucket
) – a Bucket objectreporter (
ProgressReport
) – a place to report errors
- Return type:
- do_report(bucket, reporter)[source]
Report the hiding action performed.
- Parameters:
bucket (
Bucket
) – a Bucket objectreporter (
SyncReport
) – a place to report errors
- class b2sdk._internal.sync.action.B2DownloadAction(source_path, b2_file_name, local_full_path, encryption_settings_provider)[source]
Bases:
AbstractAction
- Parameters:
source_path (
B2Path
) –b2_file_name (
str
) –local_full_path (
str
) –encryption_settings_provider (
AbstractSyncEncryptionSettingsProvider
) –
- __init__(source_path, b2_file_name, local_full_path, encryption_settings_provider)[source]
- Parameters:
source_path (
B2Path
) – the file to be downloadedb2_file_name (
str
) – b2_file_namelocal_full_path (
str
) – a local file pathencryption_settings_provider (
AbstractSyncEncryptionSettingsProvider
) – encryption setting provider
- class b2sdk._internal.sync.action.B2CopyAction(b2_file_name, source_path, dest_b2_file_name, source_bucket, destination_bucket, encryption_settings_provider)[source]
Bases:
AbstractAction
File copying action.
- Parameters:
b2_file_name (
str
) –source_path (
B2Path
) –source_bucket (
Bucket
) –destination_bucket (
Bucket
) –encryption_settings_provider (
AbstractSyncEncryptionSettingsProvider
) –
- __init__(b2_file_name, source_path, dest_b2_file_name, source_bucket, destination_bucket, encryption_settings_provider)[source]
- Parameters:
b2_file_name (
str
) – a b2_file_namesource_path (
B2Path
) – the file to be copieddest_b2_file_name – a name of a destination remote file
source_bucket (
Bucket
) – bucket to copy fromdestination_bucket (
Bucket
) – bucket to copy toencryption_settings_provider (
AbstractSyncEncryptionSettingsProvider
) – encryption setting provider
- class b2sdk._internal.sync.action.B2DeleteAction(relative_name, b2_file_name, file_id, note)[source]
Bases:
AbstractAction
- do_action(bucket, reporter)[source]
Perform the deleting action, returning only after the action is completed.
- Parameters:
bucket (
Bucket
) – a Bucket objectreporter (
ProgressReport
) – a place to report errors
- do_report(bucket, reporter)[source]
Report the deleting action performed.
- Parameters:
bucket (
Bucket
) – a Bucket objectreporter (
SyncReport
) – a place to report errors
- class b2sdk._internal.sync.action.LocalDeleteAction(relative_name, full_path)[source]
Bases:
AbstractAction
- do_action(bucket, reporter)[source]
Perform the deleting of a local file action, returning only after the action is completed.
- Parameters:
bucket (
Bucket
) – a Bucket objectreporter (
ProgressReport
) – a place to report errors
- do_report(bucket, reporter)[source]
Report the deleting of a local file action performed.
- Parameters:
bucket (
Bucket
) – a Bucket objectreporter (
SyncReport
) – a place to report errors