Skip to main content

AsyncClientImpl

This class represents an asynchronous client for a catalog service. It is designed to queue both download and upload requests using dedicated workqueues for reading and writing operations.

Attributes​

AttributeTypeDescription
Readerworkqueue.IndexedWorkQueueThe workqueue used for queuing download requests.
Writerworkqueue.IndexedWorkQueueThe workqueue used for queuing upload requests.

Methods​


Download()​

@classmethod
def Download(
ctx: context.Context,
requests: [DownloadRequest](downloadrequest.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_downloadrequest)
) - > DownloadFuture

Queues a download request on the workqueue. Callers use this to initiate asynchronous file downloads.

Parameters​

NameTypeDescription
ctxcontext.ContextThe context for the download operation, allowing for cancellation and deadlines.
requests[DownloadRequest](downloadrequest.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_downloadrequest)The specific details of the file to be downloaded, including source and destination.

Returns​

TypeDescription
DownloadFutureA future that will eventually hold the result of the download operation.

Upload()​

@classmethod
def Upload(
ctx: context.Context,
requests: [UploadRequest](uploadrequest.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_uploadrequest)
) - > [UploadFuture](uploadfuture.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_uploadfuture)

Queues an upload request on the workqueue. Callers use this to initiate asynchronous file uploads.

Parameters​

NameTypeDescription
ctxcontext.ContextThe context for the upload operation, allowing for cancellation and deadlines.
requests[UploadRequest](uploadrequest.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_uploadrequest)The specific details of the file to be uploaded, including source and destination.

Returns​

TypeDescription
[UploadFuture](uploadfuture.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_uploadfuture)A future that will eventually hold the result of the upload operation.

Start()​

@classmethod
def Start(
ctx: context.Context
) - > error

Initializes and starts the asynchronous client's internal workqueues. This method must be called before any download or upload operations can be processed.

Parameters​

NameTypeDescription
ctxcontext.ContextThe context for starting the client, allowing for cancellation and deadlines during initialization.

Returns​

TypeDescription
errorAn error if the client failed to start, otherwise nil.