Azure / Azure/azure-sdk-for-rust
Support global configuration of default transport for client libraries
- Dominant language
- Rust
- Stars
- 884
- Forks
- 365
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 112
Description
Like other Azure SDK languages, we should support callers setting global configuration of transports.
Currently we have `new_htt_client()` but that's only to return our default based on features. It would be hard for callers to plug into that. Instead, we might consider a design similar to overriding the `AsyncRuntime` e.g.,
```rust
pub fn set_default_http_client(client: T) {
todo!()
}
pub fn get_default_http_client(options: Option) -> Result {
todo!("get previously set default or return new_http_client()")
}
```
We'd pass in `ClientOptions` or similar so that we can pass through transport options that a client library or customer might need, like disabling auto-decompression in Storage or to configure timeouts as described in #4210.
Note that some client libraries like Storage or Cosmos may not use this because they have very specific scenarios they must support, but will honor the `ClientOptions::transport` field or similar.
Contributor guide
Research direction
Start by reading the existing new_htt_client() implementation and the AsyncRuntime override design. Trace how client libraries obtain transports and how ClientOptions, including ClientOptions::transport, could flow through them; review #4210 for timeout requirements. Done means the global default can be set and retrieved while preserving per-client transport options, with exceptions for libraries such as Storage and Cosmos documented or handled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api, networking
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100