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

Introduce CallOptions, to support future per-call options (like timeouts) #275

Closed
wants to merge 3 commits into from

Conversation

jhump
Copy link
Member

@jhump jhump commented May 16, 2024

This doesn't add anything new (like per-call timeouts) yet, but it sets up the APIs to allow adding it in the future.

The main change is to replace the use of Headers as an argument for every RPC invocation to instead be a new CallOptions type, and request headers are one of the options. (In this PR, they are actually the only option. But we'd add per-call timeouts in the future, and possibly even per-call options relating to compression.)

This is done in a backwards-compatible way so that updating to this version of the library does not require re-generating code or changing application code. So it keeps the old method signatures, but deprecates them. In the generated code, the deprecated functions all have default implementations in the interface to call the new form, so that the generated implementation classes only need to override the new signature.

You can get an idea for what the generated interfaces look like by looking at the changes in ProtocolClientInterface.

You can review this commit-by-commit. I ran full tests (including the whole conformance suite) after each commit, as a way to verify backwards-compatibility of gen code and application code. The first commit updates the library; the second commit updates the gen-code; the third commit updates application code.

@jhump jhump requested a review from pkwarren May 16, 2024 02:12
@jhump jhump changed the title Pre-factoring, to support additional per-call options, like a timeout Introduce CallOptions, to support future per-call options (like timeouts) May 16, 2024
@jhump jhump force-pushed the jh/prefactoring-to-add-other-call-options branch from e9f5f97 to c717f39 Compare May 16, 2024 12:39
@jhump
Copy link
Member Author

jhump commented May 16, 2024

I'm going to hold off on this change. I think this is definitely useful -- both to support per-call timeouts as a feature in the future, but also as a pattern that lets us extend the API further in the future without breaking callers. But it's not really necessary just to fix the timeout issues, which is really my current aim.

@jhump jhump closed this May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant