-
Notifications
You must be signed in to change notification settings - Fork 120
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
RFC: design suggestion: Make this a "3-tier library" #392
Comments
I agree with most of the things you mention. And I'm +1 on the general proposal. However I don't get why we should be able to override most settings in tier3. If tier2 is basically free to create, I don't see any benefit by overriding the settings. In my point of view the client should be a struct with value semantics. |
@fabianfett good point! I don't know either :D |
Different TLS configurations interact somewhat poorly with the connection pool, as they produce new keys. So this isn't entirely a panacea for the connection pool re-use. Otherwise agreed. |
Agreed, but we already have that issue/feature today. And we added it because people very commonly requested it, usually because the need a different trust roots/client certs to talk to different services. |
And I would suggest a rename However this leads us to the point where we have a |
I don't like giving it such a specific name because it can be more than a connection pool. And also, most users have no idea what a connection pool is. |
also CC @adam-fowler , I think https://github.com/soto-project/soto has a similar-ish design? |
Soto has two tiers, in that you have
The In theory you could call the I guess there are similarities to what is described above in that let s3 = S3(client: awsClient, region: .euwest1)
s3.getObject(bucket: "my-bucket", key: "my-file")
s3.with(options: .s3UseDualStackEndpoint).getObject(bucket: "my-bucket", key: "my-file")
s3.with(timeout: .minutes(15)).getObject(bucket: "my-bucket", key: "my-file") |
@fabianfett Thanks! I kinda like |
@fabianfett / @Lukasa / @adam-fowler I think we need to make progress on this issue. For a user of AsyncHTTPClient I see the following problem over and over again: Let's say I have a library that internally does some HTTP. Currently, I have two options for it:
Both options feel bad but I run into them all the time :(. |
At the moment, we have a pretty gnarly issue with AHC's API: Settings can either be supplied globally or per request. So if you want to set certain configuration for a certain component in your app (say TLS config, redirect config, ...) then you either have to specify it for every single request (tedious) or globally (expensive as you'll get a new connection pool, need to maintain lifecycle etc).
What I suggest here is making AHC a "3-tier library":
HTTPClient
: the highly stateful, expensive, and lifecycle-managed object that owns theTLSContext
, the connection pool, and if not.shared
also the ELGstruct
) and not lifecycle managed client object which is essentially a reference to the tier 1 object and a bag of configurationAn API sketch could look like this:
Benefits
Important requirements per tier
Tier 1
Tier 2
Tier 3
The text was updated successfully, but these errors were encountered: