Skip to main content

LocalAsyncUploadService

Trait LocalAsyncUploadService 

Source
pub trait LocalAsyncUploadService<O, I: Stream<Item = Result<Bytes, Error>>> {
    // Required methods
    fn initiate_multipart_upload(
        &self,
        auth_: &BearerToken,
        upload_request: &InitiateMultipartUploadRequest,
    ) -> impl Future<Output = Result<InitiateMultipartUploadResponse, Error>>;
    fn list_parts(
        &self,
        auth_: &BearerToken,
        upload_id: &str,
        key: &str,
    ) -> impl Future<Output = Result<Vec<PartWithSize>, Error>>;
    fn sign_part(
        &self,
        auth_: &BearerToken,
        upload_id: &str,
        key: &str,
        part_number: i32,
    ) -> impl Future<Output = Result<SignPartResponse, Error>>;
    fn complete_multipart_upload(
        &self,
        auth_: &BearerToken,
        upload_id: &str,
        key: &str,
        parts: &[Part],
    ) -> impl Future<Output = Result<CompleteMultipartUploadResponse, Error>>;
    fn abort_multipart_upload(
        &self,
        auth_: &BearerToken,
        upload_id: &str,
        key: &str,
    ) -> impl Future<Output = Result<(), Error>>;
    fn sign_download(
        &self,
        auth_: &BearerToken,
        request: &SignDownloadRequest,
    ) -> impl Future<Output = Result<SignDownloadResponse, Error>>;
    fn upload_file(
        &self,
        auth_: &BearerToken,
        file_name: &str,
        size_bytes: Option<SafeLong>,
        workspace: Option<&WorkspaceRid>,
        body: impl LocalAsyncWriteBody<O>,
    ) -> impl Future<Output = Result<S3Path, Error>>;
}
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>>

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: &str, key: &str, ) -> impl Future<Output = Result<Vec<PartWithSize>, Error>>

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

Source

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

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: &str, key: &str, parts: &[Part], ) -> impl Future<Output = Result<CompleteMultipartUploadResponse, Error>>

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: &str, key: &str, ) -> impl Future<Output = Result<(), Error>>

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>>

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: &str, size_bytes: Option<SafeLong>, workspace: Option<&WorkspaceRid>, body: impl LocalAsyncWriteBody<O>, ) -> impl Future<Output = Result<S3Path, Error>>

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§

Source§

impl<O, I: Stream<Item = Result<Bytes, Error>>, __C> LocalAsyncUploadService<O, I> for LocalAsyncUploadServiceClient<__C>
where __C: LocalAsyncClient<BodyWriter = O, ResponseBody = I>,