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

example(bindings): add async ConfigResolver #4477

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

jmayclin
Copy link
Contributor

Description of changes:

Adds an example showing how to use the async ConfigResolver.

Call-outs:

I haven't decided whether this should be a self contained server, or whether it should just be two separate resolver's that can be used. I think I'm leaning towards the latter.

Testing:

How is this change tested (unit tests, fuzz tests, etc.)? Are there any testing steps to be verified by the reviewer?

Is this a refactor change? If so, how have you proved that the intended behavior hasn't changed?

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@github-actions github-actions bot added the s2n-core team label Mar 27, 2024
@jmayclin jmayclin marked this pull request as ready for review May 23, 2024 03:24
jmayclin and others added 3 commits May 23, 2024 17:33
…async_load_server.rs

Co-authored-by: Sam Clark <3758302+goatgoose@users.noreply.github.com>
- make server config consume self
Comment on lines +39 to +44
// If this method took in `&self`, then
// ```
// let config_resolver = ConfigResolver::new(self.server_config(animal));
// ```
// wouldn't compile because the compiler would complain that `&self` doesn't
// live long enough.
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you maybe solve this more intuitively by returning a clone of config_resolver instead of consuming a clone of async_resolver_clone? Or does that not work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure that I'm following (I need to edit that doc comment to refer to the explicit AsyncAnimalConfigResolver, which might have made things more confusing)

server_config(animal) could return a type which directly implements the Future trait, but that would require customers to write all of the actual polling logic for the type, which is very complex and unpleasant.

I originally had this structure as taking in &self but that was also a little tricky, see: #4477 (comment)

I agree that this is a bit unpleasant to deal with, but I think returning a type that directly implemented Future would be even less pleasant ☹️

- remove unused struct
@jmayclin jmayclin requested a review from lrstewart June 4, 2024 01:13
- remove unused imports. Need to add this check to CI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants