pub trait UploadService<I> {
// Required methods
fn initiate_multipart_upload(
&self,
auth_: BearerToken,
upload_request: InitiateMultipartUploadRequest,
) -> Result<InitiateMultipartUploadResponse, Error>;
fn list_parts(
&self,
auth_: BearerToken,
upload_id: String,
key: String,
) -> Result<Vec<PartWithSize>, Error>;
fn sign_part(
&self,
auth_: BearerToken,
upload_id: String,
key: String,
part_number: i32,
) -> Result<SignPartResponse, Error>;
fn complete_multipart_upload(
&self,
auth_: BearerToken,
upload_id: String,
key: String,
parts: Vec<Part>,
) -> Result<CompleteMultipartUploadResponse, Error>;
fn abort_multipart_upload(
&self,
auth_: BearerToken,
upload_id: String,
key: String,
) -> Result<(), Error>;
fn upload_file(
&self,
auth_: BearerToken,
file_name: String,
size_bytes: Option<SafeLong>,
workspace: Option<WorkspaceRid>,
body: I,
) -> Result<S3Path, Error>;
}
Expand description
The Upload Service manages file uploads to object storage.
Required Methods§
Sourcefn initiate_multipart_upload(
&self,
auth_: BearerToken,
upload_request: InitiateMultipartUploadRequest,
) -> Result<InitiateMultipartUploadResponse, Error>
fn initiate_multipart_upload( &self, auth_: BearerToken, upload_request: InitiateMultipartUploadRequest, ) -> Result<InitiateMultipartUploadResponse, Error>
Initiates a multipart upload to object storage. Returns an uploadId that should be used with listParts, signPart, and completeMultipartUpload.
Sourcefn list_parts(
&self,
auth_: BearerToken,
upload_id: String,
key: String,
) -> Result<Vec<PartWithSize>, Error>
fn list_parts( &self, auth_: BearerToken, upload_id: String, key: String, ) -> Result<Vec<PartWithSize>, Error>
Lists the parts that have been uploaded for a given uploadId.
Sourcefn sign_part(
&self,
auth_: BearerToken,
upload_id: String,
key: String,
part_number: i32,
) -> Result<SignPartResponse, Error>
fn sign_part( &self, auth_: BearerToken, upload_id: String, key: String, part_number: i32, ) -> Result<SignPartResponse, Error>
Signs an upload request for a single part. Returns a URL that will execute the upload without further authentication.
Sourcefn complete_multipart_upload(
&self,
auth_: BearerToken,
upload_id: String,
key: String,
parts: Vec<Part>,
) -> Result<CompleteMultipartUploadResponse, Error>
fn complete_multipart_upload( &self, auth_: BearerToken, upload_id: String, key: String, parts: Vec<Part>, ) -> 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.
Sourcefn abort_multipart_upload(
&self,
auth_: BearerToken,
upload_id: String,
key: String,
) -> Result<(), Error>
fn abort_multipart_upload( &self, auth_: BearerToken, upload_id: String, key: String, ) -> Result<(), Error>
Aborts a multipart upload to S3. Frees storage used by previously uploaded parts and prevents further uploads to the same uploadId.
Sourcefn upload_file(
&self,
auth_: BearerToken,
file_name: String,
size_bytes: Option<SafeLong>,
workspace: Option<WorkspaceRid>,
body: I,
) -> Result<S3Path, Error>
fn upload_file( &self, auth_: BearerToken, file_name: String, size_bytes: Option<SafeLong>, workspace: Option<WorkspaceRid>, body: I, ) -> Result<S3Path, Error>
Uploads a file to S3. Intended for smaller files.