Skip to content

Commit

Permalink
xds: Rename parseCluster() back to processCluster() for consistency
Browse files Browse the repository at this point in the history
This is to keep names of the top-level process* functions called from
handle*Response functions, and returning *Update resources consistent:

- `handleLdsResponse()` -> `LdsUpdate processClientSideListener()`
                           `LdsUpdate processServerSideListener()`
- `handleCdsResponse()` -> `CdsUpdate processCluster()`
- `handleRdsResponse()` -> `RdsUpdate processRouteConfiguration()`
- `handleEdsResponse()` -> `EdsUpdate processClusterLoadAssignment()`

For some reason, processCluster() was renamed to parseCluster() in
fa4b980.
  • Loading branch information
sergiitk committed Jan 6, 2022
1 parent 86b8b26 commit 01b51ad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions xds/src/main/java/io/grpc/xds/ClientXdsClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -1485,7 +1485,7 @@ public void handleCdsResponse(
if (getBootstrapInfo() != null && getBootstrapInfo().certProviders() != null) {
certProviderInstances = getBootstrapInfo().certProviders().keySet();
}
cdsUpdate = parseCluster(cluster, retainedEdsResources, certProviderInstances, serverInfo);
cdsUpdate = processCluster(cluster, retainedEdsResources, certProviderInstances, serverInfo);
} catch (ResourceInvalidException e) {
errors.add(
"CDS response Cluster '" + clusterName + "' validation error: " + e.getMessage());
Expand All @@ -1503,7 +1503,7 @@ public void handleCdsResponse(
}

@VisibleForTesting
static CdsUpdate parseCluster(Cluster cluster, Set<String> retainedEdsResources,
static CdsUpdate processCluster(Cluster cluster, Set<String> retainedEdsResources,
Set<String> certProviderInstances, ServerInfo serverInfo)
throws ResourceInvalidException {
StructOrError<CdsUpdate.Builder> structOrError;
Expand Down
8 changes: 4 additions & 4 deletions xds/src/test/java/io/grpc/xds/ClientXdsClientDataTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1353,7 +1353,7 @@ public void parseCluster_ringHashLbPolicy_defaultLbConfig() throws ResourceInval
.setLbPolicy(LbPolicy.RING_HASH)
.build();

CdsUpdate update = ClientXdsClient.parseCluster(
CdsUpdate update = ClientXdsClient.processCluster(
cluster, new HashSet<String>(), null, LRS_SERVER_INFO);
assertThat(update.lbPolicy()).isEqualTo(CdsUpdate.LbPolicy.RING_HASH);
assertThat(update.minRingSize())
Expand Down Expand Up @@ -1381,7 +1381,7 @@ public void parseCluster_transportSocketMatches_exception() throws ResourceInval
thrown.expect(ResourceInvalidException.class);
thrown.expectMessage(
"Cluster cluster-foo.googleapis.com: transport-socket-matches not supported.");
ClientXdsClient.parseCluster(cluster, new HashSet<String>(), null, LRS_SERVER_INFO);
ClientXdsClient.processCluster(cluster, new HashSet<String>(), null, LRS_SERVER_INFO);
}

@Test
Expand All @@ -1406,7 +1406,7 @@ public void parseCluster_ringHashLbPolicy_invalidRingSizeConfig_minGreaterThanMa

thrown.expect(ResourceInvalidException.class);
thrown.expectMessage("Cluster cluster-foo.googleapis.com: invalid ring_hash_lb_config");
ClientXdsClient.parseCluster(cluster, new HashSet<String>(), null, LRS_SERVER_INFO);
ClientXdsClient.processCluster(cluster, new HashSet<String>(), null, LRS_SERVER_INFO);
}

@Test
Expand All @@ -1433,7 +1433,7 @@ public void parseCluster_ringHashLbPolicy_invalidRingSizeConfig_tooLargeRingSize

thrown.expect(ResourceInvalidException.class);
thrown.expectMessage("Cluster cluster-foo.googleapis.com: invalid ring_hash_lb_config");
ClientXdsClient.parseCluster(cluster, new HashSet<String>(), null, LRS_SERVER_INFO);
ClientXdsClient.processCluster(cluster, new HashSet<String>(), null, LRS_SERVER_INFO);
}

@Test
Expand Down

0 comments on commit 01b51ad

Please sign in to comment.