MCPcopy Create free account
hub / github.com/apple/foundationdb / getAddressesByLocality

Function getAddressesByLocality

fdbclient/ManagementAPI.actor.cpp:1752–1765  ·  view source on GitHub ↗

Returns the list of IPAddresses of the workers that match the given locality. Example: locality="dcid:primary" returns all the ip addresses of the workers in the primary dc.

Source from the content-addressed store, hash-verified

1750// Returns the list of IPAddresses of the workers that match the given locality.
1751// Example: locality="dcid:primary" returns all the ip addresses of the workers in the primary dc.
1752std::set<AddressExclusion> getAddressesByLocality(const std::vector<ProcessData>& workers,
1753 const std::string& locality) {
1754 std::pair<std::string, std::string> localityKeyValue = decodeLocality(locality);
1755
1756 std::set<AddressExclusion> localityAddresses;
1757 for (int i = 0; i < workers.size(); i++) {
1758 if (workers[i].locality.isPresent(localityKeyValue.first) &&
1759 workers[i].locality.get(localityKeyValue.first) == localityKeyValue.second) {
1760 localityAddresses.insert(AddressExclusion(workers[i].address.ip, workers[i].address.port));
1761 }
1762 }
1763
1764 return localityAddresses;
1765}
1766
1767ACTOR Future<Void> printHealthyZone(Database cx) {
1768 state Transaction tr(cx);

Calls 6

decodeLocalityFunction · 0.85
AddressExclusionClass · 0.85
getMethod · 0.65
sizeMethod · 0.45
isPresentMethod · 0.45
insertMethod · 0.45

Tested by 1

parseLocalitiesFromKeysFunction · 0.68