[translation]: Add a library for substituting one gRPC method for ano… - #152
Open
Vaughan-Temporal wants to merge 1 commit into
Open
[translation]: Add a library for substituting one gRPC method for ano…#152Vaughan-Temporal wants to merge 1 commit into
Vaughan-Temporal wants to merge 1 commit into
Conversation
…ther Some upstreams do not serve a method under the name a caller knows it by. The proxy can forward a method or refuse it, but it has no way to answer one call with a different one, which is what an upstream that exposes the same capability under another service requires. Add internal/translation. A Translation names the inbound method, the method that stands in for it, and the conversions between their message types; a Registry indexes them by inbound method; and a unary client interceptor converts the request, sends it under the substituted method, and folds the reply back into the message the caller is waiting on. Nothing else on the connection needs to know a substitution happened. Adapt builds a Translation from two typed conversions, so a mapping is written against concrete message types and never asserts on proto.Message itself. The response conversion is given the original request as well as the upstream reply, because a request field the upstream has no equivalent for can only be honoured on the way back. WithHeader stamps metadata the substituted API requires, set rather than appended, and only on a call that was actually substituted. Via sends the substituted call over a different connection, for an upstream method the original connection's service does not serve at all. It leaves the interceptor chain at that point, which is why callers install this innermost: everything above then sees the method and message types the caller asked for. No translations are registered yet, so nothing changes.
|
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! 🚀 New features to boost your workflow:
|
This was referenced Sep 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds Method Translation Library. Review focus should generally be on the typing and structure of this, since this is establishing a new pattern.
The core idea here is we do full message capture instead of frame by frame capture. We can not know the details of what we are translating, so that falls upon the Actual translation integration for each message set.