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

Function parseNetWorkAddrFromKeys

fdbclient/SpecialKeySpace.actor.cpp:891–924  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

889}
890
891bool parseNetWorkAddrFromKeys(ReadYourWritesTransaction* ryw,
892 bool failed,
893 std::vector<AddressExclusion>& addresses,
894 std::set<AddressExclusion>& exclusions,
895 Optional<std::string>& msg) {
896 KeyRangeRef range = failed ? SpecialKeySpace::getManagementApiCommandRange("failed")
897 : SpecialKeySpace::getManagementApiCommandRange("exclude");
898 auto ranges = ryw->getSpecialKeySpaceWriteMap().containedRanges(range);
899 auto iter = ranges.begin();
900 while (iter != ranges.end()) {
901 auto entry = iter->value();
902 // only check for exclude(set) operation, include(clear) are not checked
903 TraceEvent(SevDebug, "ParseNetworkAddress")
904 .detail("Valid", entry.first)
905 .detail("Set", entry.second.present())
906 .detail("Key", iter->begin().toString());
907 if (entry.first && entry.second.present()) {
908 Key address = iter->begin().removePrefix(range.begin);
909 auto a = AddressExclusion::parse(address);
910 if (!a.isValid()) {
911 std::string error = "ERROR: \'" + address.toString() + "\' is not a valid network endpoint address\n";
912 if (address.toString().find(":tls") != std::string::npos)
913 error += " Do not include the `:tls' suffix when naming a process\n";
914 msg = ManagementAPIError::toJsonString(
915 false, entry.second.present() ? (failed ? "exclude failed" : "exclude") : "include", error);
916 return false;
917 }
918 addresses.push_back(a);
919 exclusions.insert(a);
920 }
921 ++iter;
922 }
923 return true;
924}
925
926ACTOR Future<bool> checkExclusion(Database db,
927 std::vector<AddressExclusion>* addresses,

Callers 1

Calls 14

TraceEventClass · 0.85
containedRangesMethod · 0.80
detailMethod · 0.80
parseFunction · 0.70
beginMethod · 0.45
endMethod · 0.45
valueMethod · 0.45
presentMethod · 0.45
toStringMethod · 0.45
removePrefixMethod · 0.45
isValidMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected