Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ObjectStore Wasm32 Fixes (#4775) (#4776) #4796

Merged
merged 1 commit into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes #4776 in that it documents that the http feature is 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"))]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the fix for #4775

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