pub struct S3Transfer { /* private fields */ }Implementations§
Source§impl S3Transfer
impl S3Transfer
pub fn new(config: S3Config) -> Result<Self>
pub fn new_with_client(config: S3Config, client: Arc<Client>) -> Self
Sourcepub fn parse_s3_url(url: &str) -> Result<(String, String)>
pub fn parse_s3_url(url: &str) -> Result<(String, String)>
从 s3://bucket/path 格式的 URL 中解析 bucket 和 key
Sourcepub async fn initiate_multipart(
&self,
bucket: &str,
key: &str,
) -> Result<String>
pub async fn initiate_multipart( &self, bucket: &str, key: &str, ) -> Result<String>
Step 1: Initiate a Multipart Upload, returns the UploadId.
Sourcepub async fn upload_part(
&self,
bucket: &str,
key: &str,
upload_id: &str,
part_number: u32,
data: Vec<u8>,
) -> Result<String>
pub async fn upload_part( &self, bucket: &str, key: &str, upload_id: &str, part_number: u32, data: Vec<u8>, ) -> Result<String>
Step 2: Upload a single part. Returns the ETag header value.
part_number is 1-indexed.
Sourcepub async fn complete_multipart(
&self,
bucket: &str,
key: &str,
upload_id: &str,
parts: &[(u32, String)],
) -> Result<()>
pub async fn complete_multipart( &self, bucket: &str, key: &str, upload_id: &str, parts: &[(u32, String)], ) -> Result<()>
Step 3: Complete the Multipart Upload.
parts is a list of (part_number, etag) pairs, 1-indexed, in order.
Sourcepub async fn abort_multipart(
&self,
bucket: &str,
key: &str,
upload_id: &str,
) -> Result<()>
pub async fn abort_multipart( &self, bucket: &str, key: &str, upload_id: &str, ) -> Result<()>
Abort a Multipart Upload (cleanup on failure).
Sourcepub async fn upload_auto(
&self,
file_path: &Path,
url: &str,
progress_tx: UnboundedSender<TransferProgress>,
) -> Result<()>
pub async fn upload_auto( &self, file_path: &Path, url: &str, progress_tx: UnboundedSender<TransferProgress>, ) -> Result<()>
Automatically choose between simple PUT and Multipart Upload.
Uses multipart_threshold from config to decide.
Reports progress via progress_tx after each uploaded part.
For multipart uploads, returns the UploadId + completed parts via
an optional ResumeState callback so callers can persist for resume.
Trait Implementations§
Source§impl TransferProtocol for S3Transfer
impl TransferProtocol for S3Transfer
fn upload_file<'life0, 'life1, 'async_trait>(
&'life0 self,
task: &'life1 TransferTask,
progress_tx: UnboundedSender<TransferProgress>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn download_file<'life0, 'life1, 'async_trait>(
&'life0 self,
task: &'life1 TransferTask,
progress_tx: UnboundedSender<TransferProgress>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn resume_transfer<'life0, 'life1, 'async_trait>(
&'life0 self,
task: &'life1 TransferTask,
_offset: u64,
progress_tx: UnboundedSender<TransferProgress>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn supports_resume(&self) -> bool
fn protocol_name(&self) -> &'static str
Auto Trait Implementations§
impl Freeze for S3Transfer
impl !RefUnwindSafe for S3Transfer
impl Send for S3Transfer
impl Sync for S3Transfer
impl Unpin for S3Transfer
impl UnsafeUnpin for S3Transfer
impl !UnwindSafe for S3Transfer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more