Struct qiniu_upload_manager::UploadManager
source · pub struct UploadManager(_);
Expand description
上传管理器
Implementations§
source§impl UploadManager
impl UploadManager
sourcepub fn builder(
upload_token: impl Into<UploadTokenSigner>
) -> UploadManagerBuilder
pub fn builder(
upload_token: impl Into<UploadTokenSigner>
) -> UploadManagerBuilder
创建上传管理构建器
sourcepub fn new(upload_token: impl Into<UploadTokenSigner>) -> Self
pub fn new(upload_token: impl Into<UploadTokenSigner>) -> Self
创建上传管理器
sourcepub fn upload_token(&self) -> &UploadTokenSigner
pub fn upload_token(&self) -> &UploadTokenSigner
获取上传凭证签发器
Examples found in repository?
src/multi_parts_uploader/mod.rs (line 303)
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396
fn access_key(&self) -> ApiResult<AccessKey> {
self.upload_manager().upload_token().access_key()
}
fn bucket_name(&self) -> ApiResult<BucketName> {
self.upload_manager().upload_token().bucket_name()
}
#[cfg(feature = "async")]
fn async_access_key(&self) -> BoxFuture<ApiResult<AccessKey>> {
Box::pin(async move { self.upload_manager().upload_token().async_access_key().await })
}
#[cfg(feature = "async")]
fn async_bucket_name(&self) -> BoxFuture<ApiResult<BucketName>> {
Box::pin(async move { self.upload_manager().upload_token().async_bucket_name().await })
}
fn get_bucket_regions(&self, params: &ObjectParams) -> ApiResult<GotRegions> {
if let Some(region_provider) = params.region_provider() {
region_provider.get_all(Default::default())
} else {
self.get_bucket_region()?.get_all(Default::default())
}
}
#[cfg(feature = "async")]
fn async_get_bucket_regions<'a>(&'a self, params: &'a ObjectParams) -> BoxFuture<'a, ApiResult<GotRegions>> {
Box::pin(async move {
if let Some(region_provider) = params.region_provider() {
region_provider.async_get_all(Default::default()).await
} else {
self.async_get_bucket_region()
.await?
.async_get_all(Default::default())
.await
}
})
}
fn get_up_endpoints(&self, params: &ObjectParams) -> ApiResult<Endpoints> {
let options = EndpointsGetOptions::builder().service_names(&[ServiceName::Up]).build();
let up_endpoints = if let Some(region_provider) = params.region_provider() {
RegionsProviderEndpoints::new(region_provider)
.get_endpoints(options)?
.into_owned()
} else {
RegionsProviderEndpoints::new(self.get_bucket_region()?)
.get_endpoints(options)?
.into_owned()
};
Ok(up_endpoints)
}
#[cfg(feature = "async")]
fn async_get_up_endpoints<'a>(&'a self, params: &'a ObjectParams) -> BoxFuture<'a, ApiResult<Endpoints>> {
Box::pin(async move {
let options = EndpointsGetOptions::builder().service_names(&[ServiceName::Up]).build();
let up_endpoints = if let Some(region_provider) = params.region_provider() {
RegionsProviderEndpoints::new(region_provider)
.async_get_endpoints(options)
.await?
.into_owned()
} else {
RegionsProviderEndpoints::new(self.async_get_bucket_region().await?)
.async_get_endpoints(options)
.await?
.into_owned()
};
Ok(up_endpoints)
})
}
fn get_bucket_region(&self) -> ApiResult<BucketRegionsProvider> {
Ok(self
.upload_manager()
.queryer()
.query(self.access_key()?, self.bucket_name()?))
}
#[cfg(feature = "async")]
fn async_get_bucket_region(&self) -> BoxFuture<ApiResult<BucketRegionsProvider>> {
Box::pin(async move {
Ok(self
.upload_manager()
.queryer()
.query(self.async_access_key().await?, self.async_bucket_name().await?))
})
}
fn make_upload_token_signer(&self, object_name: Option<ObjectName>) -> OwnedUploadTokenProviderOrReferenced<'_> {
self.upload_manager()
.upload_token()
.make_upload_token_provider(object_name)
}
More examples
src/single_part_uploader/form_uploader.rs (line 387)
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411
fn make_upload_token_signer(&self, params: &ObjectParams) -> OwnedUploadTokenProviderOrReferenced<'_> {
let object_name = params.object_name().map(ObjectName::from);
self.upload_manager
.upload_token()
.make_upload_token_provider(object_name)
}
fn put_object(&self) -> put_object::Client {
self.upload_manager.client().storage().put_object()
}
fn access_key(&self) -> ApiResult<AccessKey> {
self.upload_manager.upload_token().access_key()
}
fn bucket_name(&self) -> ApiResult<BucketName> {
self.upload_manager.upload_token().bucket_name()
}
#[cfg(feature = "async")]
async fn async_access_key(&self) -> ApiResult<AccessKey> {
self.upload_manager.upload_token().async_access_key().await
}
#[cfg(feature = "async")]
async fn async_bucket_name(&self) -> ApiResult<BucketName> {
self.upload_manager.upload_token().async_bucket_name().await
}
sourcepub fn client(&self) -> &QiniuApiClient
pub fn client(&self) -> &QiniuApiClient
获取七牛 API 调用客户端
Examples found in repository?
More examples
sourcepub fn queryer(&self) -> &BucketRegionsQueryer
pub fn queryer(&self) -> &BucketRegionsQueryer
获取存储空间相关区域查询器
Examples found in repository?
src/single_part_uploader/form_uploader.rs (line 372)
369 370 371 372 373 374 375 376 377 378 379 380 381 382
fn get_bucket_region(&self) -> ApiResult<BucketRegionsProvider> {
Ok(self
.upload_manager
.queryer()
.query(self.access_key()?, self.bucket_name()?))
}
#[cfg(feature = "async")]
async fn async_get_bucket_region(&self) -> ApiResult<BucketRegionsProvider> {
Ok(self
.upload_manager
.queryer()
.query(self.async_access_key().await?, self.async_bucket_name().await?))
}
More examples
src/multi_parts_uploader/mod.rs (line 378)
375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390
fn get_bucket_region(&self) -> ApiResult<BucketRegionsProvider> {
Ok(self
.upload_manager()
.queryer()
.query(self.access_key()?, self.bucket_name()?))
}
#[cfg(feature = "async")]
fn async_get_bucket_region(&self) -> BoxFuture<ApiResult<BucketRegionsProvider>> {
Box::pin(async move {
Ok(self
.upload_manager()
.queryer()
.query(self.async_access_key().await?, self.async_bucket_name().await?))
})
}
sourcepub fn single_part_uploader(&self) -> impl SinglePartUploader
pub fn single_part_uploader(&self) -> impl SinglePartUploader
创建默认的单请求上传器
sourcepub fn multi_parts_uploader<H: Digest + Send + 'static, R: ResumableRecorder<HashAlgorithm = H> + 'static>(
&self,
resumable_recorder: R
) -> impl MultiPartsUploader<HashAlgorithm = H>
pub fn multi_parts_uploader<H: Digest + Send + 'static, R: ResumableRecorder<HashAlgorithm = H> + 'static>(
&self,
resumable_recorder: R
) -> impl MultiPartsUploader<HashAlgorithm = H>
创建默认的分片上传器
sourcepub fn multi_parts_v1_uploader<H: Digest + Send + 'static, R: ResumableRecorder<HashAlgorithm = H> + 'static>(
&self,
resumable_recorder: R
) -> MultiPartsV1Uploader<H>
pub fn multi_parts_v1_uploader<H: Digest + Send + 'static, R: ResumableRecorder<HashAlgorithm = H> + 'static>(
&self,
resumable_recorder: R
) -> MultiPartsV1Uploader<H>
创建分片上传器 V1
sourcepub fn multi_parts_v2_uploader<H: Digest + Send + 'static, R: ResumableRecorder<HashAlgorithm = H> + 'static>(
&self,
resumable_recorder: R
) -> MultiPartsV2Uploader<H>
pub fn multi_parts_v2_uploader<H: Digest + Send + 'static, R: ResumableRecorder<HashAlgorithm = H> + 'static>(
&self,
resumable_recorder: R
) -> MultiPartsV2Uploader<H>
创建分片上传器 V2
sourcepub fn auto_uploader<H: Digest + Send + 'static>(&self) -> AutoUploader<H>
pub fn auto_uploader<H: Digest + Send + 'static>(&self) -> AutoUploader<H>
创建自动上传器
sourcepub fn auto_uploader_builder<H: Digest + Send + 'static>(
&self
) -> AutoUploaderBuilder<H>
pub fn auto_uploader_builder<H: Digest + Send + 'static>(
&self
) -> AutoUploaderBuilder<H>
创建自动上传构建器
Trait Implementations§
source§impl Clone for UploadManager
impl Clone for UploadManager
source§fn clone(&self) -> UploadManager
fn clone(&self) -> UploadManager
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for UploadManager
impl Send for UploadManager
impl Sync for UploadManager
impl Unpin for UploadManager
impl !UnwindSafe for UploadManager
Blanket Implementations§
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
source§fn 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
source§fn 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 moresource§fn 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 moresource§fn 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,
source§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,
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,
source§fn 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.source§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,
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,
Mutably borrows
self
, then passes self.as_mut()
into the pipe
function.§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> Tap for T
impl<T> Tap for T
source§fn 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 moresource§fn 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 moresource§fn 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 moresource§fn 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 moresource§fn 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 moresource§fn 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 moresource§fn 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.source§fn 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.source§fn 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.source§fn 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.source§fn 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.source§fn 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.