pub trait SinglePartUploader: Sealed + UploaderWithCallbacks + Clone + Sync + Send + Debug {
fn new(upload_manager: UploadManager) -> Self;
fn upload_path(
&self,
path: impl AsRef<Path>,
params: ObjectParams
) -> ApiResult<Value>;
fn upload_reader<R: Read + 'static>(
&self,
reader: R,
params: ObjectParams
) -> ApiResult<Value>;
fn async_upload_path<'a>(
&'a self,
path: impl AsRef<Path> + Send + Sync + 'a,
params: ObjectParams
) -> BoxFuture<'a, ApiResult<Value>>;
fn async_upload_reader<R: AsyncRead + Unpin + Send + Sync + 'static>(
&self,
reader: R,
params: ObjectParams
) -> BoxFuture<'_, ApiResult<Value>>;
}Expand description
单请求上传器接口
仅通过一次 HTTP 请求即上传整个数据源,适合数据量较小的数据源,不提供断点恢复的能力。
Required Methods
sourcefn new(upload_manager: UploadManager) -> Self
fn new(upload_manager: UploadManager) -> Self
创建单请求上传器
sourcefn upload_path(
&self,
path: impl AsRef<Path>,
params: ObjectParams
) -> ApiResult<Value>
fn upload_path(
&self,
path: impl AsRef<Path>,
params: ObjectParams
) -> ApiResult<Value>
上传指定路径的文件
该方法的异步版本为 Self::async_upload_path。
sourcefn upload_reader<R: Read + 'static>(
&self,
reader: R,
params: ObjectParams
) -> ApiResult<Value>
fn upload_reader<R: Read + 'static>(
&self,
reader: R,
params: ObjectParams
) -> ApiResult<Value>
上传输入流的数据
该方法的异步版本为 Self::async_upload_reader。
sourcefn async_upload_path<'a>(
&'a self,
path: impl AsRef<Path> + Send + Sync + 'a,
params: ObjectParams
) -> BoxFuture<'a, ApiResult<Value>>
fn async_upload_path<'a>(
&'a self,
path: impl AsRef<Path> + Send + Sync + 'a,
params: ObjectParams
) -> BoxFuture<'a, ApiResult<Value>>
Available on crate feature
async only.异步上传指定路径的文件
sourcefn async_upload_reader<R: AsyncRead + Unpin + Send + Sync + 'static>(
&self,
reader: R,
params: ObjectParams
) -> BoxFuture<'_, ApiResult<Value>>
fn async_upload_reader<R: AsyncRead + Unpin + Send + Sync + 'static>(
&self,
reader: R,
params: ObjectParams
) -> BoxFuture<'_, ApiResult<Value>>
Available on crate feature
async only.上传异步输入流的数据