| 889 | } |
| 890 | |
| 891 | bool 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 | |
| 926 | ACTOR Future<bool> checkExclusion(Database db, |
| 927 | std::vector<AddressExclusion>* addresses, |
no test coverage detected