MCPcopy Create free account
hub / github.com/grpc/grpc-java / filter

Method filter

xds/src/main/java/io/grpc/xds/AddressFilter.java:69–83  ·  view source on GitHub ↗

Returns the next level hierarchical addresses derived from the given hierarchical addresses with the given filter name (any non-hierarchical addresses in the input will be ignored). This method does not modify the input addresses.

(List<EquivalentAddressGroup> addresses, String name)

Source from the content-addressed store, hash-verified

67 * This method does not modify the input addresses.
68 */
69 static List<EquivalentAddressGroup> filter(List<EquivalentAddressGroup> addresses, String name) {
70 checkNotNull(addresses, "addresses");
71 checkNotNull(name, "name");
72 List<EquivalentAddressGroup> filteredAddresses = new ArrayList<>();
73 for (EquivalentAddressGroup address : addresses) {
74 PathChain pathChain = address.getAttributes().get(PATH_CHAIN_KEY);
75 if (pathChain != null && pathChain.name.equals(name)) {
76 Attributes filteredAddressAttrs =
77 address.getAttributes().toBuilder().set(PATH_CHAIN_KEY, pathChain.next).build();
78 filteredAddresses.add(
79 new EquivalentAddressGroup(address.getAddresses(), filteredAddressAttrs));
80 }
81 }
82 return Collections.unmodifiableList(filteredAddresses);
83 }
84
85 static final class PathChain {
86 final String name;

Callers 4

filterAddressesMethod · 0.95
longerPathChainMethod · 0.95

Calls 9

checkNotNullMethod · 0.80
getMethod · 0.65
getAttributesMethod · 0.65
buildMethod · 0.65
setMethod · 0.65
addMethod · 0.65
equalsMethod · 0.45
toBuilderMethod · 0.45
getAddressesMethod · 0.45

Tested by 2

filterAddressesMethod · 0.76
longerPathChainMethod · 0.76