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

Function getProcessAddressByServerID

fdbcli/StatusCommand.actor.cpp:117–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117std::string getProcessAddressByServerID(StatusObjectReader processesMap, std::string serverID) {
118 if (serverID == "")
119 return "unknown";
120
121 for (auto proc : processesMap.obj()) {
122 try {
123 StatusArray rolesArray = proc.second.get_obj()["roles"].get_array();
124 for (StatusObjectReader role : rolesArray) {
125 if (role["id"].get_str().find(serverID) == 0) {
126 // If this next line throws, then we found the serverID but the role has no address, so the role is
127 // skipped.
128 return proc.second.get_obj()["address"].get_str();
129 }
130 }
131 } catch (std::exception&) {
132 // If an entry in the process map is badly formed then something will throw. Since we are
133 // looking for a positive match, just ignore any read execeptions and move on to the next proc
134 }
135 }
136 return "unknown";
137}
138
139std::string getWorkloadRates(StatusObjectReader statusObj,
140 bool unknown,

Callers 1

printStatusFunction · 0.85

Calls 1

findMethod · 0.45

Tested by

no test coverage detected