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

roboto.storage.file_service

Module Contents

FileService

class roboto.storage.file_service.FileService(roboto_client=None, object_store_registry=None)#View Source

Application service for performing upload and download to the Roboto Platform.

Agnostic to object store provider.

Parameters

roboto_client Optional[roboto.http.RobotoClient]
object_store_registry Optional[roboto.storage.object_store.StoreRegistry]

FileService.download()

download(files, association, caller_org_id=None, on_progress=None)#View Source

Download files from the Roboto Platform.

Parameters

files collections.abc.Sequence[roboto.storage.download_session.DownloadableFile]

Sequence of files to download, each with source_uri and destination_path.

Association of the files to download.

caller_org_id Optional[str]

Optional organization ID for cross-org access.

Optional callback to be periodically called with the number of bytes downloaded.

Return type

None

FileService.upload()

upload(files, association, destination_paths={}, batch_size=_DEFAULT_UPLOAD_BATCH_SIZE, device_id=None, caller_org_id=None, on_progress=None)#View Source

Upload the given files and return which file record each one created.

Parameters

files collections.abc.Iterable[pathlib.Path]
destination_paths collections.abc.Mapping[pathlib.Path, str]
batch_size int
device_id Optional[str]
caller_org_id Optional[str]

Returns

dict[pathlib.Path, str]

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

Raises

ValueError

If two of the given files resolve to the same destination path: their uploads would overwrite each other and only one could appear in the returned mapping. Files without a destination_paths entry are destined for their own basename, so two like-named files from different directories collide unless given distinct destinations.

OSError

If a given file cannot be read.

logger

roboto.storage.file_service.logger#View Source

Was this page helpful?