pub struct SerialMultiPartsUploaderScheduler<M: MultiPartsUploader> { /* private fields */ }Expand description
串行分片上传调度器
不启动任何线程,仅在本地串行上传分片。
用串行分片上传调度器上传文件
阻塞代码示例
use qiniu_upload_manager::{
apis::credential::Credential, prelude::*, FileSystemResumableRecorder, MultiPartsV2Uploader,
ObjectParams, SerialMultiPartsUploaderScheduler, UploadManager, UploadTokenSigner,
};
use std::time::Duration;
use sha1::Sha1;
let bucket_name = "test-bucket";
let object_name = "test-object";
let upload_manager = UploadManager::builder(UploadTokenSigner::new_credential_provider(
Credential::new("abcdefghklmnopq", "1234567890"),
bucket_name,
Duration::from_secs(3600),
))
.build();
let params = ObjectParams::builder().object_name(object_name).file_name(object_name).build();
let mut scheduler = SerialMultiPartsUploaderScheduler::new(MultiPartsV2Uploader::new(
upload_manager,
FileSystemResumableRecorder::<Sha1>::default(),
));
scheduler.upload_path("/home/qiniu/test.png", params)?;异步代码示例
use qiniu_upload_manager::{
apis::credential::Credential, prelude::*, FileSystemResumableRecorder, MultiPartsV2Uploader,
ObjectParams, SerialMultiPartsUploaderScheduler, UploadManager, UploadTokenSigner,
};
use std::time::Duration;
use sha1::Sha1;
let bucket_name = "test-bucket";
let object_name = "test-object";
let upload_manager = UploadManager::builder(UploadTokenSigner::new_credential_provider(
Credential::new("abcdefghklmnopq", "1234567890"),
bucket_name,
Duration::from_secs(3600),
))
.build();
let params = ObjectParams::builder().object_name(object_name).file_name(object_name).build();
let mut scheduler = SerialMultiPartsUploaderScheduler::new(MultiPartsV2Uploader::new(
upload_manager,
FileSystemResumableRecorder::<Sha1>::default(),
));
scheduler.async_upload_path("/home/qiniu/test.png", params).await?;Implementations
sourceimpl<M: MultiPartsUploader> SerialMultiPartsUploaderScheduler<M>
impl<M: MultiPartsUploader> SerialMultiPartsUploaderScheduler<M>
sourcepub fn data_partition_provider(&self) -> &dyn DataPartitionProvider
pub fn data_partition_provider(&self) -> &dyn DataPartitionProvider
获取分片大小提供者
Trait Implementations
sourceimpl<M: Clone + MultiPartsUploader> Clone for SerialMultiPartsUploaderScheduler<M>
impl<M: Clone + MultiPartsUploader> Clone for SerialMultiPartsUploaderScheduler<M>
sourcefn clone(&self) -> SerialMultiPartsUploaderScheduler<M>
fn clone(&self) -> SerialMultiPartsUploaderScheduler<M>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresourceimpl<M: Debug + MultiPartsUploader> Debug for SerialMultiPartsUploaderScheduler<M>
impl<M: Debug + MultiPartsUploader> Debug for SerialMultiPartsUploaderScheduler<M>
sourceimpl<M: MultiPartsUploader> MultiPartsUploaderScheduler<<M as MultiPartsUploader>::HashAlgorithm> for SerialMultiPartsUploaderScheduler<M>
impl<M: MultiPartsUploader> MultiPartsUploaderScheduler<<M as MultiPartsUploader>::HashAlgorithm> for SerialMultiPartsUploaderScheduler<M>
sourcefn set_concurrency_provider(
&mut self,
_concurrency_provider: Box<dyn ConcurrencyProvider>
)
fn set_concurrency_provider(
&mut self,
_concurrency_provider: Box<dyn ConcurrencyProvider>
)
设置并发数提供者
sourcefn set_data_partition_provider(
&mut self,
data_partition_provider: Box<dyn DataPartitionProvider>
)
fn set_data_partition_provider(
&mut self,
data_partition_provider: Box<dyn DataPartitionProvider>
)
设置分片大小提供者
sourcefn upload(
&self,
source: Box<dyn DataSource<M::HashAlgorithm>>,
params: ObjectParams
) -> ApiResult<Value>
fn upload(
&self,
source: Box<dyn DataSource<M::HashAlgorithm>>,
params: ObjectParams
) -> ApiResult<Value>
上传数据源 Read more
sourcefn async_upload(
&self,
source: Box<dyn AsyncDataSource<M::HashAlgorithm>>,
params: ObjectParams
) -> BoxFuture<'_, ApiResult<Value>>
fn async_upload(
&self,
source: Box<dyn AsyncDataSource<M::HashAlgorithm>>,
params: ObjectParams
) -> BoxFuture<'_, ApiResult<Value>>
Available on crate feature
async only.异步上传数据源
Auto Trait Implementations
impl<M> !RefUnwindSafe for SerialMultiPartsUploaderScheduler<M>
impl<M> Send for SerialMultiPartsUploaderScheduler<M>
impl<M> Sync for SerialMultiPartsUploaderScheduler<M>
impl<M> Unpin for SerialMultiPartsUploaderScheduler<M>where
M: Unpin,
impl<M> !UnwindSafe for SerialMultiPartsUploaderScheduler<M>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
sourcefn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
sourcefn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self and passes that borrow into the pipe function. Read moresourcefn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self and passes that borrow into the pipe function. Read moresourcefn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
sourcefn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
sourcefn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
Borrows
self, then passes self.as_ref() into the pipe function.sourcefn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> Tap for T
impl<T> Tap for T
sourcefn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
Immutable access to the
Borrow<B> of a value. Read moresourcefn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
Mutable access to the
BorrowMut<B> of a value. Read moresourcefn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
Immutable access to the
AsRef<R> view of a value. Read moresourcefn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
Mutable access to the
AsMut<R> view of a value. Read moresourcefn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
Immutable access to the
Deref::Target of a value. Read moresourcefn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
Mutable access to the
Deref::Target of a value. Read moresourcefn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap() only in debug builds, and is erased in release builds.sourcefn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut() only in debug builds, and is erased in release
builds. Read moresourcefn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
Calls
.tap_borrow() only in debug builds, and is erased in release
builds. Read moresourcefn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
Calls
.tap_borrow_mut() only in debug builds, and is erased in release
builds. Read moresourcefn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
Calls
.tap_ref() only in debug builds, and is erased in release
builds. Read moresourcefn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
Calls
.tap_ref_mut() only in debug builds, and is erased in release
builds. Read more