1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//! # multibucket
//!
//! A small, async, backend-agnostic object-storage facade. Application code is
//! written once against the [`ObjectStorage`] trait and can be pointed at any
//! bucket — the "multi-bucket" idea. The first (and currently only) backend is
//! **Qiniu Kodo (七牛云对象存储)**, implemented from the raw HTTP API so the
//! crate pulls in almost no heavyweight dependencies.
//!
//! ## Quick start
//!
//! ```no_run
//! use std::time::Duration;
//! use bytes::Bytes;
//! use multibucket::{ObjectStorage, PutBody, PutOptions, backends::qiniu::{QiniuClient, QiniuConfig, Region}};
//!
//! # async fn run() -> multibucket::Result<()> {
//! let cfg = QiniuConfig::new("AK", "SK", "my-bucket").region(Region::Z0);
//! let client = QiniuClient::new(cfg);
//!
//! // Upload.
//! client.put("docs/readme.txt", PutBody::from(Bytes::from("hello")), &PutOptions::default()).await?;
//!
//! // Download.
//! let data = client.get("docs/readme.txt").await?;
//!
//! // Metadata / existence / delete.
//! let _meta = client.stat("docs/readme.txt").await?;
//! assert!(client.exists("docs/readme.txt").await?);
//! client.delete("docs/readme.txt").await?;
//!
//! // Time-limited download URL (signed automatically for private buckets).
//! let url = client.presign_get("docs/readme.txt", Duration::from_secs(600))?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Backends
//!
//! * [`backends::qiniu`] — Qiniu Kodo. See [`QiniuClient`](backends::qiniu::QiniuClient).
//!
//! ## Feature notes
//!
//! * Signing (upload token / private download / `QBox` management) follows the
//! official Qiniu algorithm docs and is implemented in
//! [`backends::qiniu::Mac`].
//! * Large files can be uploaded with the resumable / multipart API
//! ([`ObjectStorage::put_resumable`]); the Qiniu backend exposes the
//! lower-level [`MultipartUpload`](backends::qiniu::MultipartUpload) handle
//! and [`ResumeState`](backends::qiniu::ResumeState) for cross-restart resume.
//! * TLS uses `rustls` (no OpenSSL needed), so it builds cleanly on Windows.
//! * Creating a bucket or switching it between public / private is available on
//! the Qiniu client ([`QiniuClient::create_bucket`](backends::qiniu::QiniuClient::create_bucket),
//! [`set_bucket_private`](backends::qiniu::QiniuClient::set_bucket_private)).
//! Those are account-level control-plane calls, so they deliberately stay out
//! of the backend-agnostic [`ObjectStorage`] trait.
//! * All uploads/downloads go through a single reusable `reqwest::Client`; pass
//! your own via [`QiniuClient::with_http`](backends::qiniu::QiniuClient::with_http)
//! to control timeouts and proxies.
pub use ;
pub use ;
pub use ;