Xuanwo commented on issue #4427:
URL: https://github.com/apache/opendal/issues/4427#issuecomment-7170896304

   For Rust S3, independently built operators can already share the work of 
fetching credentials. Give each builder a credential chain backed by the same 
`Arc<Provider>`, and keep the cached credentials in that provider. For example, 
with `provider` shared by the builders:
   
   ```rust
   let chain = ProvideCredentialChain::new().push(Arc::clone(&provider));
   let builder = builder.credential_provider_chain(chain);
   ```
   
   I checked OpenDAL `0.59.5` and `main` at `c5f382dbfe` with four alternating 
`stat` calls and a local transport that checked for a signature on each `HEAD`. 
Two independent operators with different roots and the same transport called 
the shared provider twice on each version. With an uncached provider, this 
produced two underlying credential loads. With caching inside the provider, it 
produced one. An operator and its clone called the provider once. The test used 
synthetic credentials and made no IAM requests. [S3 
builder](https://github.com/apache/opendal/blob/c5f382dbfe/core/services/s3/src/backend.rs#L581-L589)
   
   Early invalidation is a separate requirement. While Reqsign considers its 
cached credential valid for the request, it signs without consulting the 
provider. Evicting the application’s copy therefore cannot guarantee immediate 
refresh. Which service and language binding need this, and is the remaining 
requirement to avoid repeated acquisition across operators or to force a 
refresh while a cached credential is still valid? Keeping the issue open for 
that distinction. [Reqsign cache 
lookup](https://github.com/apache/reqsign/blob/v0.20.9/core/src/signer.rs#L131-L154)
   
   *AI-generated maintenance comment.*
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to