cds: ClusterImplLoadBalancer to use acceptResolvedAddresses() (#9571)

This is part of the API migration away from handleResolvedAddresses().
This commit is contained in:
Terry Wilson 2022-10-10 15:55:57 -07:00 committed by GitHub
parent ab78f39f23
commit 458e06fafa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 9 deletions

View File

@ -102,7 +102,7 @@ final class ClusterImplLoadBalancer extends LoadBalancer {
}
@Override
public void handleResolvedAddresses(ResolvedAddresses resolvedAddresses) {
public boolean acceptResolvedAddresses(ResolvedAddresses resolvedAddresses) {
logger.log(XdsLogLevel.DEBUG, "Received resolution result: {0}", resolvedAddresses);
Attributes attributes = resolvedAddresses.getAttributes();
if (xdsClientPool == null) {
@ -134,6 +134,7 @@ final class ClusterImplLoadBalancer extends LoadBalancer {
.setAttributes(attributes)
.setLoadBalancingPolicyConfig(config.childPolicy.getConfig())
.build());
return true;
}
@Override
@ -162,11 +163,6 @@ final class ClusterImplLoadBalancer extends LoadBalancer {
}
}
@Override
public boolean canHandleEmptyAddressListFromNameResolution() {
return true;
}
/**
* A decorated {@link LoadBalancer.Helper} that applies configurations for connections
* or requests to endpoints in the cluster.

View File

@ -282,7 +282,7 @@ public class ClusterImplLoadBalancerTest {
config = new ClusterImplConfig(CLUSTER, EDS_SERVICE_NAME, LRS_SERVER_INFO, null,
Collections.singletonList(DropOverload.create("lb", 1_000_000)),
new PolicySelection(weightedTargetProvider, weightedTargetConfig), null);
loadBalancer.handleResolvedAddresses(
loadBalancer.acceptResolvedAddresses(
ResolvedAddresses.newBuilder()
.setAddresses(Collections.singletonList(endpoint))
.setAttributes(
@ -571,7 +571,7 @@ public class ClusterImplLoadBalancerTest {
private void deliverAddressesAndConfig(List<EquivalentAddressGroup> addresses,
ClusterImplConfig config) {
loadBalancer.handleResolvedAddresses(
loadBalancer.acceptResolvedAddresses(
ResolvedAddresses.newBuilder()
.setAddresses(addresses)
.setAttributes(
@ -677,10 +677,11 @@ public class ClusterImplLoadBalancerTest {
}
@Override
public void handleResolvedAddresses(ResolvedAddresses resolvedAddresses) {
public boolean acceptResolvedAddresses(ResolvedAddresses resolvedAddresses) {
addresses = resolvedAddresses.getAddresses();
config = resolvedAddresses.getLoadBalancingPolicyConfig();
attributes = resolvedAddresses.getAttributes();
return true;
}
@Override