Skip to content

Commit

Permalink
ObjectStore Wasm32 Fixes (#4775) (#4776) (#4796)
Browse files Browse the repository at this point in the history
  • Loading branch information
tustvold authored Sep 14, 2023
1 parent 2075cd1 commit 229bf8b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/object_store.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ jobs:
run: cargo clippy --features gcp -- -D warnings
- name: Run clippy with azure feature
run: cargo clippy --features azure -- -D warnings
- name: Run clippy with http feature
run: cargo clippy --features http -- -D warnings
- name: Run clippy with all features
run: cargo clippy --all-features -- -D warnings
- name: Run clippy with all features and all targets
Expand Down
2 changes: 1 addition & 1 deletion object_store/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ See [docs.rs](https://docs.rs/object_store) for usage instructions

## Support for `wasm32-unknown-unknown` target

It's possible to build `object_store` for the `wasm32-unknown-unknown` target, however the cloud storage features `aws`, `azure`, and `gcp` are not supported.
It's possible to build `object_store` for the `wasm32-unknown-unknown` target, however the cloud storage features `aws`, `azure`, `gcp`, and `http` are not supported.

```
cargo build -p object_store --target wasm32-unknown-unknown
Expand Down
3 changes: 2 additions & 1 deletion object_store/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
//! Generic utilities reqwest based ObjectStore implementations
pub mod backoff;

#[cfg(test)]
pub mod mock_server;

Expand All @@ -35,7 +36,6 @@ pub mod list;
#[cfg(any(feature = "aws", feature = "gcp", feature = "azure"))]
pub mod token;

#[cfg(any(feature = "aws", feature = "gcp", feature = "azure"))]
pub mod header;

#[cfg(any(feature = "aws", feature = "gcp"))]
Expand Down Expand Up @@ -575,6 +575,7 @@ pub struct StaticCredentialProvider<T> {
}

impl<T> StaticCredentialProvider<T> {
/// A [`CredentialProvider`] for a static credential of type `T`
pub fn new(credential: T) -> Self {
Self {
credential: Arc::new(credential),
Expand Down
18 changes: 9 additions & 9 deletions object_store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,9 @@
#[cfg(all(
target_arch = "wasm32",
any(feature = "gcp", feature = "aws", feature = "azure",)
any(feature = "gcp", feature = "aws", feature = "azure", feature = "http")
))]
compile_error!("Features 'gcp', 'aws', 'azure' are not supported on wasm.");
compile_error!("Features 'gcp', 'aws', 'azure', 'http' are not supported on wasm.");

#[cfg(feature = "aws")]
pub mod aws;
Expand All @@ -263,13 +263,16 @@ pub mod path;
pub mod prefix;
pub mod throttle;

#[cfg(any(feature = "gcp", feature = "aws", feature = "azure", feature = "http"))]
#[cfg(feature = "cloud")]
mod client;

#[cfg(any(feature = "gcp", feature = "aws", feature = "azure", feature = "http"))]
pub use client::{backoff::BackoffConfig, retry::RetryConfig, CredentialProvider};
#[cfg(feature = "cloud")]
pub use client::{
backoff::BackoffConfig, retry::RetryConfig, ClientConfigKey, ClientOptions,
CredentialProvider, StaticCredentialProvider,
};

#[cfg(any(feature = "gcp", feature = "aws", feature = "azure", feature = "http"))]
#[cfg(feature = "cloud")]
mod config;

#[cfg(feature = "cloud")]
Expand All @@ -295,9 +298,6 @@ use std::ops::Range;
use std::sync::Arc;
use tokio::io::AsyncWrite;

#[cfg(any(feature = "azure", feature = "aws", feature = "gcp", feature = "http"))]
pub use client::{ClientConfigKey, ClientOptions};

/// An alias for a dynamically dispatched object store implementation.
pub type DynObjectStore = dyn ObjectStore;

Expand Down
2 changes: 1 addition & 1 deletion object_store/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl ObjectStoreScheme {
}
}

#[cfg(any(feature = "aws", feature = "gcp", feature = "azure", feature = "http"))]
#[cfg(any(feature = "aws", feature = "gcp", feature = "azure"))]
macro_rules! builder_opts {
($builder:ty, $url:expr, $options:expr) => {{
let builder = $options.into_iter().fold(
Expand Down

0 comments on commit 229bf8b

Please sign in to comment.