-
Notifications
You must be signed in to change notification settings - Fork 4.6k
xds/resolver: pass route's auto_host_rewrite to LB picker (gRFC A81) #8740
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
Changes from 4 commits
a6618d6
b8ef6f5
aff1b32
afcc3fb
d494492
29dd0bb
9cbcc98
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -194,3 +194,25 @@ func (d *picker) Pick(info balancer.PickInfo) (balancer.PickResult, error) { | |
|
|
||
| return pr, err | ||
| } | ||
|
|
||
| // autoHostRewriteKey is the context key used to store the value of | ||
| // route's autoHostRewrite in the RPC context. | ||
| type autoHostRewriteKey struct{} | ||
|
|
||
| // AutoHostRewrite retrieves the autoHostRewrite value from the provided context. | ||
| func AutoHostRewrite(ctx context.Context) bool { | ||
| autohostRewrite, _ := ctx.Value(autoHostRewriteKey{}).(bool) | ||
| return autohostRewrite | ||
|
||
| } | ||
|
|
||
| // GetAutoHostRewriteForTesting returns the value of autoHostRewrite feild; | ||
easwars marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
easwars marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // to be used for testing only. | ||
| func GetAutoHostRewriteForTesting(ctx context.Context) bool { | ||
| return AutoHostRewrite(ctx) | ||
| } | ||
|
|
||
| // SetAutoHostRewrite adds the autoHostRewrite value to the context for | ||
| // the xds_cluster_impl LB policy to pick. | ||
| func SetAutoHostRewrite(ctx context.Context, autohostRewrite bool) context.Context { | ||
| return context.WithValue(ctx, autoHostRewriteKey{}, autohostRewrite) | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.