Skip to content
Roboto
Esc
↑↓navigate↵open⌘Jpreview
On this page

roboto.storage.upload_transaction

Module Contents

TransactionFile

class roboto.storage.upload_transaction.TransactionFile#View Source

Bases: TypedDict

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Attributes

TransactionFile.destination_path

destination_path str #

TransactionFile.file_size

file_size int #

TransactionFile.local_path

local_path pathlib.Path #

UploadTransaction

class roboto.storage.upload_transaction.UploadTransaction(items, association, device_id=None, origination=None, batch_size=None, roboto_client=None, caller_org_id=None)#View Source

Parameters

items collections.abc.Sequence[TransactionFile]
device_id Optional[str]
origination Optional[str]
batch_size Optional[int]
roboto_client Optional[roboto.http.RobotoClient]
caller_org_id Optional[str]

UploadTransaction.await_uploads()

await_uploads()#View Source

Wait for all registered uploads to complete, then report progress to API.

Must be called while still inside the object_store context manager, since the transfer manager may be shut down when that context exits.

Raises

ExceptionGroup

If any uploads fail, an ExceptionGroup containing all upload errors is raised after reporting successfully completed uploads.

If the server’s progress response reports (uri, file_id) pairs that do not correspond one-to-one with the uploads reported to it.

Return type

None

Properties

UploadTransaction.completed_uploads

completed_uploads dict[pathlib.Path, str] #

Mapping from each uploaded local path to the ID of the file record it created.

Populated from the {uri, file_id} pairs in progress-report responses, and complete for every upload already reported to PUT v1/files/upload/<id>/progress, which await_uploads() does at each batch boundary. A pair set that does not correspond one-to-one with the reported uploads raises instead of degrading the mapping.

Return type: dict[pathlib.Path, str]

UploadTransaction.make_credential_provider()

make_credential_provider()#View Source

UploadTransaction.register_upload()

register_upload(file, future)#View Source

Register a pending upload future.

Call this immediately after initiating each S3 transfer. The future will be awaited when await_uploads() is called.

Return type

None

Properties

UploadTransaction.transaction_id

transaction_id str #
Return type: str

UploadTransaction.upload_mappings

upload_mappings dict[str, str] #
Return type: dict[str, str]

UploadableFile

class roboto.storage.upload_transaction.UploadableFile#View Source

Bases: TypedDict

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Attributes

UploadableFile.destination_path

destination_path str #

UploadableFile.local_path

local_path pathlib.Path #

UploadableFile.upload_uri

upload_uri str #

logger

roboto.storage.upload_transaction.logger#View Source

Was this page helpful?