-
Notifications
You must be signed in to change notification settings - Fork 4.6k
xds/internal: remove Generic resource Decoder and add concrete functions #8652
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
base: master
Are you sure you want to change the base?
xds/internal: remove Generic resource Decoder and add concrete functions #8652
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #8652 +/- ##
==========================================
+ Coverage 81.21% 81.52% +0.30%
==========================================
Files 416 416
Lines 41002 40921 -81
==========================================
+ Hits 33298 33359 +61
+ Misses 6226 6167 -59
+ Partials 1478 1395 -83
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks mostly good. Just some minor nits this time around.
// Producer watches resources via the external xdsclient API. | ||
type Producer interface { | ||
// WatchResource uses xDS to discover the resource associated with the | ||
// provided resource name. The resource type implementation determines how | ||
// xDS responses are are deserialized and validated, as received from the | ||
// xDS management server. Upon receipt of a response from the management | ||
// server, an appropriate callback on the watcher is invoked. | ||
WatchResource(rType Type, resourceName string, watcher ResourceWatcher) (cancel func()) | ||
} | ||
|
||
// ProducerV2 is like Producer, but uses the external xdsclient API. | ||
// | ||
// Once all resource type implementations have been migrated to use the external | ||
// xdsclient API, this interface will be renamed to Producer and the existing | ||
// Producer interface will be deleted. | ||
type ProducerV2 interface { | ||
WatchResourceV2(typeURL, resourceName string, watcher xdsclient.ResourceWatcher) (cancel func()) | ||
WatchResource(typeURL, resourceName string, watcher xdsclient.ResourceWatcher) (cancel func()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please retain the old comments of the Producer
interface. The fact that this interface is using the external xdsclient API is not very important here. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
} | ||
|
||
r.applyRouteConfigUpdate(update) | ||
r.applyRouteConfigUpdate(*update) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should change applyRouteConfigUpdate
to accept a pointer and change the currentRouteConfig
field to hold a pointer as well. That we won't have to deref the pointer here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
internal/xds/xdsclient/client.go
Outdated
// the watcher is canceled. Callers need to handle this case. | ||
WatchResource(rType xdsresource.Type, resourceName string, watcher xdsresource.ResourceWatcher) (cancel func()) | ||
|
||
// WatchResourceV2 matches the API of the external xdsclient interface. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to retain the old docstring for WatchResource
. That contains a bunch of useful information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Addresses: #8381
RELEASE NOTES: None