mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-15 02:18:39 +08:00
Address comments.
This commit is contained in:
parent
02f72dd377
commit
8c49391c51
@ -59,9 +59,9 @@ struct ClientLeaderRegInterface {
|
|||||||
class ClusterConnectionString {
|
class ClusterConnectionString {
|
||||||
public:
|
public:
|
||||||
ClusterConnectionString() {}
|
ClusterConnectionString() {}
|
||||||
ClusterConnectionString(std::string const& connStr);
|
ClusterConnectionString(const std::string& connStr);
|
||||||
ClusterConnectionString(std::vector<NetworkAddress> coordinators, Key key);
|
ClusterConnectionString(const std::vector<NetworkAddress>& coordinators, Key key);
|
||||||
ClusterConnectionString(std::vector<Hostname> hosts, Key key);
|
ClusterConnectionString(const std::vector<Hostname>& hosts, Key key);
|
||||||
|
|
||||||
std::vector<NetworkAddress> const& coordinators() const { return coords; }
|
std::vector<NetworkAddress> const& coordinators() const { return coords; }
|
||||||
void addResolved(Hostname hostname, NetworkAddress address) {
|
void addResolved(Hostname hostname, NetworkAddress address) {
|
||||||
@ -83,7 +83,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void parseConnString();
|
void parseConnString();
|
||||||
void parseKey(std::string const& key);
|
void parseKey(const std::string& key);
|
||||||
std::unordered_map<NetworkAddress, Hostname> networkAddressToHostname;
|
std::unordered_map<NetworkAddress, Hostname> networkAddressToHostname;
|
||||||
Key key, keyDesc;
|
Key key, keyDesc;
|
||||||
std::string connectionString;
|
std::string connectionString;
|
||||||
|
@ -172,7 +172,7 @@ void ClusterConnectionString::parseConnString() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ClusterConnectionString::ClusterConnectionString(std::string const& connStr) {
|
ClusterConnectionString::ClusterConnectionString(const std::string& connStr) {
|
||||||
connectionString = trim(connStr);
|
connectionString = trim(connStr);
|
||||||
parseConnString();
|
parseConnString();
|
||||||
}
|
}
|
||||||
@ -399,7 +399,8 @@ TEST_CASE("/fdbclient/MonitorLeader/parseConnectionString/fuzz") {
|
|||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
ClusterConnectionString::ClusterConnectionString(std::vector<NetworkAddress> servers, Key key) : coords(servers) {
|
ClusterConnectionString::ClusterConnectionString(const std::vector<NetworkAddress>& servers, Key key)
|
||||||
|
: coords(servers) {
|
||||||
std::string keyString = key.toString();
|
std::string keyString = key.toString();
|
||||||
parseKey(keyString);
|
parseKey(keyString);
|
||||||
connectionString = keyString + "@";
|
connectionString = keyString + "@";
|
||||||
@ -411,7 +412,7 @@ ClusterConnectionString::ClusterConnectionString(std::vector<NetworkAddress> ser
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ClusterConnectionString::ClusterConnectionString(std::vector<Hostname> hosts, Key key)
|
ClusterConnectionString::ClusterConnectionString(const std::vector<Hostname>& hosts, Key key)
|
||||||
: hasUnresolvedHostnames(true), hostnames(hosts) {
|
: hasUnresolvedHostnames(true), hostnames(hosts) {
|
||||||
std::string keyString = key.toString();
|
std::string keyString = key.toString();
|
||||||
parseKey(keyString);
|
parseKey(keyString);
|
||||||
@ -424,7 +425,7 @@ ClusterConnectionString::ClusterConnectionString(std::vector<Hostname> hosts, Ke
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClusterConnectionString::parseKey(std::string const& key) {
|
void ClusterConnectionString::parseKey(const std::string& key) {
|
||||||
// Check the structure of the given key, and fill in this->key and this->keyDesc
|
// Check the structure of the given key, and fill in this->key and this->keyDesc
|
||||||
|
|
||||||
// The key must contain one (and only one) : character
|
// The key must contain one (and only one) : character
|
||||||
|
Loading…
x
Reference in New Issue
Block a user