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

Function decodeExcludedServersKey

fdbclient/SystemData.cpp:858–866  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

856const KeyRef excludedServersPrefix = excludedServersKeys.begin;
857const KeyRef excludedServersVersionKey = LiteralStringRef("\xff/conf/excluded");
858AddressExclusion decodeExcludedServersKey(KeyRef const& key) {
859 ASSERT(key.startsWith(excludedServersPrefix));
860 // Returns an invalid NetworkAddress if given an invalid key (within the prefix)
861 // Excluded servers have IP in x.x.x.x format, port optional, and no SSL suffix
862 // Returns a valid, public NetworkAddress with a port of 0 if the key represents an IP address alone (meaning all
863 // ports) Returns a valid, public NetworkAddress with nonzero port if the key represents an IP:PORT combination
864
865 return AddressExclusion::parse(key.removePrefix(excludedServersPrefix));
866}
867std::string encodeExcludedServersKey(AddressExclusion const& addr) {
868 // FIXME: make sure what's persisted here is not affected by innocent changes elsewhere
869 return excludedServersPrefix.toString() + addr.toString();

Calls 3

parseFunction · 0.70
startsWithMethod · 0.45
removePrefixMethod · 0.45

Tested by

no test coverage detected