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

Function decodeFailedServersKey

fdbclient/SystemData.cpp:887–895  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

885const KeyRef failedServersPrefix = failedServersKeys.begin;
886const KeyRef failedServersVersionKey = LiteralStringRef("\xff/conf/failed");
887AddressExclusion decodeFailedServersKey(KeyRef const& key) {
888 ASSERT(key.startsWith(failedServersPrefix));
889 // Returns an invalid NetworkAddress if given an invalid key (within the prefix)
890 // Excluded servers have IP in x.x.x.x format, port optional, and no SSL suffix
891 // Returns a valid, public NetworkAddress with a port of 0 if the key represents an IP address alone (meaning all
892 // ports) Returns a valid, public NetworkAddress with nonzero port if the key represents an IP:PORT combination
893
894 return AddressExclusion::parse(key.removePrefix(failedServersPrefix));
895}
896std::string encodeFailedServersKey(AddressExclusion const& addr) {
897 // FIXME: make sure what's persisted here is not affected by innocent changes elsewhere
898 return failedServersPrefix.toString() + addr.toString();

Calls 3

parseFunction · 0.70
startsWithMethod · 0.45
removePrefixMethod · 0.45

Tested by

no test coverage detected