Crate taskcluster_upload

source ·
Expand description

Support for uploading data to the Taskcluster object server.

This crate provides a set of functions to perform an object-service upload. These functions negotiate an upload method with the object service, and then perform the upload, following all of the Taskcluster recommended practices.

Each function takes the necessary metadata for the upload, a handle to the data to be uploaded, and a taskcluster::Object client. The data to be uploaded can come in a variety of forms, described below. The client must be configured with the necessary credentials to access the object service.

§Convenience Functions

Most uses of this crate can utilize upload_from_buf or upload_from_file, providing the data in the form of a buffer and a tokio::fs::File, respectively.

§Factories

An upload may be retried, in which case the upload function must have access to the object data from the beginning. This is accomplished with the AsyncReaderFactory trait, which defines a get_reader method to generate a fresh tokio::io::AsyncRead for each attempt. Users for whom the supplied convenience functions are inadequate can add their own implementation of this trait.

Structs§

Traits§

  • An AsyncReaderFactory can produce, on demand, an AsyncRead object. In the event of an upload failure, the restarted upload will use a fresh reader to start reading object content at the beginning.

Functions§

  • Upload an object from an in-memory buffer.
  • Upload an object from a File. The file must be open in read mode and must be clone-able (that is, File::try_clone() must succeed) in order to support retried uploads.
  • Upload an object using an AsyncReaderFactory. This is useful for advanced cases where one of the convenience functions is not adequate.