From 6e5c824575a4bc10cb92094b45db1b7fca88f9d5 Mon Sep 17 00:00:00 2001 From: Pavel Zwerschke Date: Fri, 25 Sep 2026 20:27:04 +0200 Subject: [PATCH] feat(core): Re-export the reqsign crates that services sign requests with Several service builders take reqsign types from the application: `S3::credential_provider_chain`, `Azblob::credential_provider_chain`, `Azdls::credential_provider_chain`, and the `credential_provider` and `credential_provider_chain` pair on `Gcs` and `GcsGrpc`. None of those types were reachable through OpenDAL, so an application that wants to plug in a credential provider of its own has to depend on `reqsign-core` and the matching backend crate directly, and keep its versions compatible with the ones the service was built with by hand. Re-export `reqsign_core` from `opendal-core` behind the existing `reqsign` feature, and the backend crate from each service that signs with it, so the types an application implements against are the ones the service uses. Point the docs of the seven builder methods at the re-exports. --- core/core/src/lib.rs | 10 ++++++++++ core/services/azblob/src/backend.rs | 4 ++++ core/services/azblob/src/lib.rs | 10 ++++++++++ core/services/azdls/src/backend.rs | 4 ++++ core/services/azdls/src/lib.rs | 10 ++++++++++ core/services/gcs-grpc/src/backend.rs | 8 ++++++++ core/services/gcs-grpc/src/lib.rs | 10 ++++++++++ core/services/gcs/src/backend.rs | 8 ++++++++ core/services/gcs/src/lib.rs | 10 ++++++++++ core/services/s3/src/backend.rs | 4 ++++ core/services/s3/src/lib.rs | 9 +++++++++ 11 files changed, 87 insertions(+) diff --git a/core/core/src/lib.rs b/core/core/src/lib.rs index 5a83622b14ac..156f8e0dec5f 100644 --- a/core/core/src/lib.rs +++ b/core/core/src/lib.rs @@ -34,6 +34,16 @@ pub mod layers; pub mod raw; pub mod services; +/// Re-export of the [`reqsign_core`] crate that services sign requests with. +/// +/// Service builders that accept credentials from the application take `reqsign` +/// types in their signatures, such as `ProvideCredentialChain` in +/// `opendal_service_s3::S3::credential_provider_chain`. Implement providers +/// against this re-export rather than depending on `reqsign-core` directly, so +/// that the types always match the ones the services are built with. +#[cfg(feature = "reqsign")] +pub use reqsign_core; + #[cfg(test)] mod tests { use super::*; diff --git a/core/services/azblob/src/backend.rs b/core/services/azblob/src/backend.rs index 62a41c877e85..5208c4350521 100644 --- a/core/services/azblob/src/backend.rs +++ b/core/services/azblob/src/backend.rs @@ -244,6 +244,10 @@ impl AzblobBuilder { } /// Replace the credential providers with a custom chain. + /// + /// Build the chain from [`opendal_core::reqsign_core`] and + /// [`crate::reqsign_azure_storage`] so that its types match the ones this + /// service is built with. pub fn credential_provider_chain(mut self, chain: ProvideCredentialChain) -> Self { self.credential_providers = Some(chain); self diff --git a/core/services/azblob/src/lib.rs b/core/services/azblob/src/lib.rs index 98b5b7ebb9ec..b93fc2ad3557 100644 --- a/core/services/azblob/src/lib.rs +++ b/core/services/azblob/src/lib.rs @@ -46,3 +46,13 @@ pub mod writer; pub use backend::AzblobBuilder as Azblob; pub use config::AzblobConfig; + +/// Re-export of the [`reqsign_azure_storage`] crate that this service signs +/// requests with. +/// +/// [`Azblob::credential_provider_chain`] takes a chain of providers for +/// [`reqsign_azure_storage::Credential`]. Implement providers against this +/// re-export and [`opendal_core::reqsign_core`] rather than depending on the +/// `reqsign` crates directly, so that the types always match the ones this +/// service is built with. +pub use reqsign_azure_storage; diff --git a/core/services/azdls/src/backend.rs b/core/services/azdls/src/backend.rs index 41625f8876ee..f7fb7d33b706 100644 --- a/core/services/azdls/src/backend.rs +++ b/core/services/azdls/src/backend.rs @@ -191,6 +191,10 @@ impl AzdlsBuilder { } /// Replace the credential providers with a custom chain. + /// + /// Build the chain from [`opendal_core::reqsign_core`] and + /// [`crate::reqsign_azure_storage`] so that its types match the ones this + /// service is built with. pub fn credential_provider_chain(mut self, chain: ProvideCredentialChain) -> Self { self.credential_providers = Some(chain); self diff --git a/core/services/azdls/src/lib.rs b/core/services/azdls/src/lib.rs index 83ab1ba373f2..8f37ea44af17 100644 --- a/core/services/azdls/src/lib.rs +++ b/core/services/azdls/src/lib.rs @@ -43,3 +43,13 @@ mod writer; pub use backend::AzdlsBuilder as Azdls; pub use config::AzdlsConfig; + +/// Re-export of the [`reqsign_azure_storage`] crate that this service signs +/// requests with. +/// +/// [`Azdls::credential_provider_chain`] takes a chain of providers for +/// [`reqsign_azure_storage::Credential`]. Implement providers against this +/// re-export and [`opendal_core::reqsign_core`] rather than depending on the +/// `reqsign` crates directly, so that the types always match the ones this +/// service is built with. +pub use reqsign_azure_storage; diff --git a/core/services/gcs-grpc/src/backend.rs b/core/services/gcs-grpc/src/backend.rs index 019940f563df..931e32c06ff2 100644 --- a/core/services/gcs-grpc/src/backend.rs +++ b/core/services/gcs-grpc/src/backend.rs @@ -105,6 +105,10 @@ impl GcsGrpcBuilder { } /// Set a custom Google credential provider. + /// + /// Implement the provider against [`opendal_core::reqsign_core`] and + /// [`crate::reqsign_google`] so that its types match the ones this service is + /// built with. pub fn credential_provider( mut self, provider: impl ProvideCredential + 'static, @@ -118,6 +122,10 @@ impl GcsGrpcBuilder { } /// Set a custom Google credential provider chain. + /// + /// Build the chain from [`opendal_core::reqsign_core`] and + /// [`crate::reqsign_google`] so that its types match the ones this service is + /// built with. pub fn credential_provider_chain(mut self, chain: ProvideCredentialChain) -> Self { self.credential_provider_chain = Some(chain); self diff --git a/core/services/gcs-grpc/src/lib.rs b/core/services/gcs-grpc/src/lib.rs index 8a9a078b679e..fc6f555325c0 100644 --- a/core/services/gcs-grpc/src/lib.rs +++ b/core/services/gcs-grpc/src/lib.rs @@ -41,3 +41,13 @@ mod writer; pub use backend::GcsGrpcBuilder as GcsGrpc; pub use config::GcsGrpcConfig; + +/// Re-export of the [`reqsign_google`] crate that this service signs requests +/// with. +/// +/// [`GcsGrpc::credential_provider`] and [`GcsGrpc::credential_provider_chain`] +/// take providers for [`reqsign_google::Credential`]. Implement providers against +/// this re-export and [`opendal_core::reqsign_core`] rather than depending on the +/// `reqsign` crates directly, so that the types always match the ones this +/// service is built with. +pub use reqsign_google; diff --git a/core/services/gcs/src/backend.rs b/core/services/gcs/src/backend.rs index 1a498a245910..61e575236b3c 100644 --- a/core/services/gcs/src/backend.rs +++ b/core/services/gcs/src/backend.rs @@ -156,6 +156,10 @@ impl GcsBuilder { /// Specify a customized credential provider used by this service. /// /// This provider will be pushed to the front of credential chain. + /// + /// Implement the provider against [`opendal_core::reqsign_core`] and + /// [`crate::reqsign_google`] so that its types match the ones this service is + /// built with. pub fn credential_provider( mut self, provider: impl ProvideCredential + 'static, @@ -168,6 +172,10 @@ impl GcsBuilder { /// Specify a customized credential provider chain used by this service. /// /// This chain will be pushed to the front of default chain. + /// + /// Build the chain from [`opendal_core::reqsign_core`] and + /// [`crate::reqsign_google`] so that its types match the ones this service is + /// built with. pub fn credential_provider_chain(mut self, chain: ProvideCredentialChain) -> Self { self.credential_provider_chain = Some(chain); self diff --git a/core/services/gcs/src/lib.rs b/core/services/gcs/src/lib.rs index ba11abf10703..fc6d1f14c589 100644 --- a/core/services/gcs/src/lib.rs +++ b/core/services/gcs/src/lib.rs @@ -33,6 +33,16 @@ mod writer; pub use backend::GcsBuilder as Gcs; pub use config::GcsConfig; +/// Re-export of the [`reqsign_google`] crate that this service signs requests +/// with. +/// +/// [`Gcs::credential_provider`] and [`Gcs::credential_provider_chain`] take +/// providers for [`reqsign_google::Credential`]. Implement providers against this +/// re-export and [`opendal_core::reqsign_core`] rather than depending on the +/// `reqsign` crates directly, so that the types always match the ones this +/// service is built with. +pub use reqsign_google; + /// URI scheme used for service registration and scheme-driven construction. pub const GCS_SCHEME: &str = "gcs"; diff --git a/core/services/s3/src/backend.rs b/core/services/s3/src/backend.rs index 14e0354a3c50..6bc2498ea832 100644 --- a/core/services/s3/src/backend.rs +++ b/core/services/s3/src/backend.rs @@ -494,6 +494,10 @@ impl S3Builder { } /// Replace the credential providers with a custom chain. + /// + /// Build the chain from [`opendal_core::reqsign_core`] and + /// [`crate::reqsign_aws_v4`] so that its types match the ones this service is + /// built with. pub fn credential_provider_chain(mut self, chain: ProvideCredentialChain) -> Self { self.credential_providers = Some(chain); self diff --git a/core/services/s3/src/lib.rs b/core/services/s3/src/lib.rs index 8e34b7dd12ff..31e4c949b8ae 100644 --- a/core/services/s3/src/lib.rs +++ b/core/services/s3/src/lib.rs @@ -32,6 +32,15 @@ mod writer; pub use backend::S3Builder as S3; pub use config::S3Config; +/// Re-export of the [`reqsign_aws_v4`] crate that this service signs requests +/// with. +/// +/// [`S3::credential_provider_chain`] takes a chain of providers for +/// [`reqsign_aws_v4::Credential`]. Implement providers against this re-export and +/// [`opendal_core::reqsign_core`] rather than depending on the `reqsign` crates +/// directly, so that the types always match the ones this service is built with. +pub use reqsign_aws_v4; + /// URI scheme used for service registration and scheme-driven construction. pub const S3_SCHEME: &str = "s3";