Skip to content

Commit 2e859ee

Browse files
authored
docs: explain *-base features and document the full feature flag set (#750)
* docs * more docs * more docs * minor changes
1 parent d339aee commit 2e859ee

6 files changed

Lines changed: 106 additions & 1 deletion

File tree

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,20 @@ It's possible to build `object_store` for the `wasm32-unknown-unknown` target, h
5050
cargo build -p object_store --target wasm32-unknown-unknown
5151
```
5252

53+
## Disabling `reqwest`
54+
55+
The `aws`, `azure`, `gcp`, and `http` features each bundle a [`reqwest`]-based HTTP transport. To target [`wasm32-wasip1`] (where `reqwest` does not compile) or otherwise supply your own HTTP client, build against the matching `*-base` feature instead:
56+
57+
```
58+
cargo build -p object_store --no-default-features --features aws-base --target wasm32-wasip1
59+
```
60+
61+
See [Disabling `reqwest`] in the crate docs for full details.
62+
63+
[`reqwest`]: https://crates.io/crates/reqwest
64+
[`wasm32-wasip1`]: https://doc.rust-lang.org/rustc/platform-support/wasm32-wasip1.html
65+
[Disabling `reqwest`]: https://docs.rs/object_store/latest/object_store/#disabling-reqwest
66+
5367
## Related Apache Crates
5468

5569
Here are several related crates in different repositories from other Apache projects.

src/aws/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717

1818
//! An object store implementation for S3
1919
//!
20+
//! See the [Feature Flags](crate#feature-flags) section for the difference
21+
//! between the `aws` and `aws-base` features.
22+
//!
2023
//! ## Multipart uploads
2124
//!
2225
//! Multipart uploads can be initiated with the [`ObjectStore::put_multipart_opts`] method.

src/azure/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717

1818
//! An object store implementation for Azure blob storage
1919
//!
20+
//! See the [Feature Flags](crate#feature-flags) section for the difference
21+
//! between the `azure` and `azure-base` features.
22+
//!
2023
//! ## Streaming uploads
2124
//!
2225
//! [`ObjectStore::put_multipart_opts`] will upload data in blocks and write a blob from those blocks.

src/gcp/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717

1818
//! An object store implementation for Google Cloud Storage
1919
//!
20+
//! See the [Feature Flags](crate#feature-flags) section for the difference
21+
//! between the `gcp` and `gcp-base` features.
22+
//!
2023
//! ## Multipart uploads
2124
//!
2225
//! [Multipart uploads](https://cloud.google.com/storage/docs/multipart-uploads)

src/http/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
//!
2020
//! This follows [rfc2518] commonly known as [WebDAV]
2121
//!
22+
//! See the [Feature Flags](crate#feature-flags) section for the difference
23+
//! between the `http` and `http-base` features.
24+
//!
2225
//! Basic get support will work out of the box with most HTTP servers,
2326
//! even those that don't explicitly support [rfc2518]
2427
//!

src/lib.rs

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@
9696
doc = "* [`http`]: [HTTP/WebDAV Storage](https://datatracker.ietf.org/doc/html/rfc2518). See [`HttpBuilder`](http::HttpBuilder)"
9797
)]
9898
//!
99+
//! See [Feature Flags](#feature-flags) for the full set of flags.
100+
//!
99101
//! # Why not a Filesystem Interface?
100102
//!
101103
//! The [`ObjectStore`] interface is designed to mirror the APIs
@@ -517,6 +519,51 @@
517519
//! [Apache Iceberg]: https://iceberg.apache.org/
518520
//! [Delta Lake]: https://delta.io/
519521
//!
522+
//! # Feature Flags
523+
//!
524+
//! The feature set is layered so that you can pick a provider independently
525+
//! of its HTTP transport:
526+
//!
527+
//! * `cloud-base` holds the shared provider implementation (XML/JSON parsing,
528+
//! credentials, retry, etc.) and intentionally does *not* depend on
529+
//! `reqwest`.
530+
//! * `reqwest` enables the built-in [`reqwest`]-based [`HttpConnector`].
531+
//! * `<provider>-base` (`aws-base`, `azure-base`, `gcp-base`, `http-base`)
532+
//! adds the per-provider logic on top of `cloud-base` without pulling in
533+
//! `reqwest`.
534+
//! * `<provider>` (`aws`, `azure`, `gcp`, `http`) is the batteries-included
535+
//! alias for `<provider>-base` + `reqwest` and is the typical choice.
536+
//!
537+
//! ## Provider features
538+
//!
539+
//! | Feature | Enables | Notes |
540+
//! | --- | --- | --- |
541+
//! | `aws` | `aws-base` + `reqwest` | Amazon S3 with the built-in HTTP transport. |
542+
//! | `azure` | `azure-base` + `reqwest` | Azure Blob Storage with the built-in HTTP transport. |
543+
//! | `gcp` | `gcp-base` + `reqwest` | Google Cloud Storage with the built-in HTTP transport. |
544+
//! | `http` | `http-base` + `reqwest` | HTTP/WebDAV with the built-in HTTP transport. |
545+
//! | `aws-base` | provider only | S3 provider without `reqwest`; supply your own [`HttpConnector`]. |
546+
//! | `azure-base` | provider only | Azure provider without `reqwest`; supply your own [`HttpConnector`]. |
547+
//! | `gcp-base` | provider only | GCS provider without `reqwest`; supply your own [`HttpConnector`]. |
548+
//! | `http-base` | provider only | HTTP/WebDAV provider without `reqwest`; supply your own [`HttpConnector`]. |
549+
//!
550+
//! ## Transport and shared features
551+
//!
552+
//! | Feature | Description |
553+
//! | --- | --- |
554+
//! | `reqwest` | Enables the default [`reqwest`]-based [`HttpConnector`]. Pulled in automatically by `aws`, `azure`, `gcp`, and `http`. |
555+
//! | `tls-webpki-roots` | When `reqwest` is enabled, also bundle Mozilla's [`webpki-roots`] CA certificates. See [TLS Certificates](#tls-certificates). |
556+
//! | `cloud-base` | Shared cloud-provider implementation. Pulled in automatically by every `*-base` feature; usually not enabled directly. |
557+
//! | `cloud` | Back-compat alias for `cloud-base` + `reqwest`. Kept for users that previously depended on the `cloud` umbrella feature. |
558+
//!
559+
//! ## Other features
560+
//!
561+
//! | Feature | Description |
562+
//! | --- | --- |
563+
//! | `fs` *(default)* | Local filesystem store via [`LocalFileSystem`](local::LocalFileSystem). |
564+
//! | `tokio` | Enables Tokio-based utilities such as [`BufReader`](buffered::BufReader) and [`BufWriter`](buffered::BufWriter). Pulled in automatically by `fs` and the `*-base` features. |
565+
//! | `integration` | Exposes the [`integration`] module, a reusable test suite for verifying custom [`ObjectStore`] implementations. Not API-stable. |
566+
//!
520567
//! # TLS Certificates
521568
//!
522569
//! Stores that use HTTPS/TLS (this is true for most cloud stores) can choose the source of their [CA]
@@ -533,9 +580,41 @@
533580
//! Many [`ObjectStore`] implementations permit customization of the HTTP client via
534581
//! the [`HttpConnector`] trait and utilities in the [`client`] module.
535582
//! Examples include injecting custom HTTP headers or using an alternate
536-
//! tokio Runtime I/O requests.
583+
//! tokio Runtime for I/O requests. To replace `reqwest` entirely (rather than
584+
//! tweak the bundled transport) see [Disabling `reqwest`](#disabling-reqwest).
537585
//!
538586
//! [`HttpConnector`]: client::HttpConnector
587+
//!
588+
//! # Disabling `reqwest`
589+
//!
590+
//! The `aws`, `azure`, `gcp`, and `http` features each bundle a
591+
//! [`reqwest`]-based HTTP transport, which is the right choice for most
592+
//! applications. If you would rather supply your own HTTP client — for example
593+
//! to share an existing client, to target a platform where `reqwest` does not
594+
//! compile (such as `wasm32-wasip1`), or to keep `reqwest` out of your
595+
//! dependency tree — use the matching `*-base` feature and provide an
596+
//! [`HttpConnector`](client::HttpConnector) at builder time.
597+
//!
598+
//! Remember to disable the default features so that `fs` (and its transitive
599+
//! dependencies) is not pulled in:
600+
//!
601+
//! ```toml
602+
//! [dependencies]
603+
//! object_store = { version = "0.13", default-features = false, features = ["aws-base"] }
604+
//! ```
605+
//!
606+
//! ```ignore
607+
//! use object_store::aws::AmazonS3Builder;
608+
//!
609+
//! let store = AmazonS3Builder::from_env()
610+
//! // `my_connector` is your own `impl HttpConnector`
611+
//! .with_http_connector(my_connector)
612+
//! .build()?;
613+
//! ```
614+
//!
615+
//! See [Feature Flags](#feature-flags) above for the full set of flags.
616+
//!
617+
//! [`reqwest`]: https://crates.io/crates/reqwest
539618
540619
#[cfg(feature = "aws-base")]
541620
pub mod aws;

0 commit comments

Comments
 (0)