xds: cluster_resolver to use acceptResolvedAddresses() (#9615)

Part of a wider migration to migrate load balancers away from
handleResolvedAddresses().
This commit is contained in:
Terry Wilson 2022-10-13 13:27:51 -07:00 committed by GitHub
parent 6904f88a7d
commit 63f3787f86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -113,7 +113,7 @@ final class ClusterResolverLoadBalancer extends LoadBalancer {
}
@Override
public void handleResolvedAddresses(ResolvedAddresses resolvedAddresses) {
public boolean acceptResolvedAddresses(ResolvedAddresses resolvedAddresses) {
logger.log(XdsLogLevel.DEBUG, "Received resolution result: {0}", resolvedAddresses);
if (xdsClientPool == null) {
xdsClientPool = resolvedAddresses.getAttributes().get(InternalXdsAttributes.XDS_CLIENT_POOL);
@ -127,6 +127,7 @@ final class ClusterResolverLoadBalancer extends LoadBalancer {
this.config = config;
delegate.handleResolvedAddresses(resolvedAddresses);
}
return true;
}
@Override
@ -170,7 +171,7 @@ final class ClusterResolverLoadBalancer extends LoadBalancer {
}
@Override
public void handleResolvedAddresses(ResolvedAddresses resolvedAddresses) {
public boolean acceptResolvedAddresses(ResolvedAddresses resolvedAddresses) {
this.resolvedAddresses = resolvedAddresses;
ClusterResolverConfig config =
(ClusterResolverConfig) resolvedAddresses.getLoadBalancingPolicyConfig();
@ -189,6 +190,7 @@ final class ClusterResolverLoadBalancer extends LoadBalancer {
clusterStates.put(instance.cluster, state);
state.start();
}
return true;
}
@Override

View File

@ -1081,7 +1081,7 @@ public class ClusterResolverLoadBalancerTest {
}
private void deliverLbConfig(ClusterResolverConfig config) {
loadBalancer.handleResolvedAddresses(
loadBalancer.acceptResolvedAddresses(
ResolvedAddresses.newBuilder()
.setAddresses(Collections.<EquivalentAddressGroup>emptyList())
.setAttributes(
@ -1325,10 +1325,11 @@ public class ClusterResolverLoadBalancerTest {
}
@Override
public void handleResolvedAddresses(ResolvedAddresses resolvedAddresses) {
public boolean acceptResolvedAddresses(ResolvedAddresses resolvedAddresses) {
addresses = resolvedAddresses.getAddresses();
config = resolvedAddresses.getLoadBalancingPolicyConfig();
attributes = resolvedAddresses.getAttributes();
return true;
}
@Override