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

Function mostUsedZoneCount

fdbrpc/ReplicationUtils.cpp:85–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85int mostUsedZoneCount(Reference<LocalitySet>& logServerSet, std::vector<LocalityEntry>& bestSet) {
86 AttribKey indexKey = logServerSet->keyIndex("zoneid");
87 std::map<AttribValue, int> entries;
88 for (int i = 0; i < bestSet.size(); i++) {
89 Optional<AttribValue> value = logServerSet->getRecordViaEntry(bestSet[i])->getValue(indexKey);
90 entries[value.get()]++;
91 }
92 int maxEntries = 0;
93 for (auto it : entries) {
94 maxEntries = std::max(maxEntries, it.second);
95 }
96 return maxEntries;
97}
98
99bool findBestPolicySetSimple(int targetUniqueValueCount,
100 Reference<LocalitySet>& logServerSet,

Callers 1

findBestPolicySetFunction · 0.85

Calls 4

keyIndexMethod · 0.80
getMethod · 0.65
sizeMethod · 0.45
getValueMethod · 0.45

Tested by

no test coverage detected