Skip to main content

AsyncUploadService

Trait AsyncUploadService 

Source
pub trait AsyncUploadService<I> {
    // Required methods
    fn initiate_multipart_upload(
        &self,
        auth_: BearerToken,
        upload_request: InitiateMultipartUploadRequest,
    ) -> impl Future<Output = Result<InitiateMultipartUploadResponse, Error>> + Send;
    fn list_parts(
        &self,
        auth_: BearerToken,
        upload_id: String,
        key: String,
    ) -> impl Future<Output = Result<Vec<PartWithSize>, Error>> + Send;
    fn sign_part(
        &self,
        auth_: BearerToken,
        upload_id: String,
        key: String,
        part_number: i32,
    ) -> impl Future<Output = Result<SignPartResponse, Error>> + Send;
    fn complete_multipart_upload(
        &self,
        auth_: BearerToken,
        upload_id: String,
        key: String,
        parts: Vec<Part>,
    ) -> impl Future<Output = Result<CompleteMultipartUploadResponse, Error>> + Send;
    fn abort_multipart_upload(
        &self,
        auth_: BearerToken,
        upload_id: String,
        key: String,
    ) -> impl Future<Output = Result<(), Error>> + Send;
    fn sign_download(
        &self,
        auth_: BearerToken,
        request: SignDownloadRequest,
    ) -> impl Future<Output = Result<SignDownloadResponse, Error>> + Send;
    fn upload_file(
        &self,
        auth_: BearerToken,
        file_name: String,
        size_bytes: Option<SafeLong>,
        workspace: Option<WorkspaceRid>,
        body: I,
    ) -> impl Future<Output = Result<S3Path, Error>> + Send;
}
Expand description

The Upload Service manages file uploads to object storage.

Required Methods§

Source

fn initiate_multipart_upload( &self, auth_: BearerToken, upload_request: InitiateMultipartUploadRequest, ) -> impl Future<Output = Result<InitiateMultipartUploadResponse, Error>> + Send

Initiates a multipart upload to object storage. Returns an uploadId that should be used with listParts, signPart, and completeMultipartUpload.

Source

fn list_parts( &self, auth_: BearerToken, upload_id: String, key: String, ) -> impl Future<Output = Result<Vec<PartWithSize>, Error>> + Send

Lists the parts that have been uploaded for a given uploadId.

Source

fn sign_part( &self, auth_: BearerToken, upload_id: String, key: String, part_number: i32, ) -> impl Future<Output = Result<SignPartResponse, Error>> + Send

Signs an upload request for a single part. Returns a URL that will execute the upload without further authentication.

Source

fn complete_multipart_upload( &self, auth_: BearerToken, upload_id: String, key: String, parts: Vec<Part>, ) -> impl Future<Output = Result<CompleteMultipartUploadResponse, Error>> + Send

Completes a multipart upload to object storage. This should be called after all parts have been uploaded. Will throw EmptyMultipartUpload if there are 0 parts.

Source

fn abort_multipart_upload( &self, auth_: BearerToken, upload_id: String, key: String, ) -> impl Future<Output = Result<(), Error>> + Send

Aborts a multipart upload to S3. Frees storage used by previously uploaded parts and prevents further uploads to the same uploadId.

Source

fn sign_download( &self, auth_: BearerToken, request: SignDownloadRequest, ) -> impl Future<Output = Result<SignDownloadResponse, Error>> + Send

Returns a short-lived signed GET URL for an object already in the uploads bucket. Use this to hand a freshly-uploaded object’s path to an external service (e.g. Dagger) without giving that service any Scout credentials. The caller must be authorized to read the workspace that owns the path (encoded as the first segment of the object key).

Source

fn upload_file( &self, auth_: BearerToken, file_name: String, size_bytes: Option<SafeLong>, workspace: Option<WorkspaceRid>, body: I, ) -> impl Future<Output = Result<S3Path, Error>> + Send

Uploads a file to S3. Intended for smaller files.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§