MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / parseHostsFromConfig

Method parseHostsFromConfig

programs/keeper-bench/Runner.cpp:192–240  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190}
191
192void Runner::parseHostsFromConfig(const Poco::Util::AbstractConfiguration & config)
193{
194 const auto fill_connection_details = [&](const std::string & key, auto & connection_info)
195 {
196 if (config.has(key + ".secure"))
197 connection_info.secure = config.getBool(key + ".secure");
198
199 if (config.has(key + ".session_timeout_ms"))
200 connection_info.session_timeout_ms = config.getInt(key + ".session_timeout_ms");
201
202 if (config.has(key + ".operation_timeout_ms"))
203 connection_info.operation_timeout_ms = config.getInt(key + ".operation_timeout_ms");
204
205 if (config.has(key + ".connection_timeout_ms"))
206 connection_info.connection_timeout_ms = config.getInt(key + ".connection_timeout_ms");
207
208 if (config.has(key + ".use_compression"))
209 connection_info.use_compression = config.getBool(key + ".use_compression");
210
211 if (config.has(key + ".use_xid_64"))
212 connection_info.use_xid_64 = config.getBool(key + ".use_xid_64");
213 };
214
215 fill_connection_details("connections", default_connection_info);
216
217 Poco::Util::AbstractConfiguration::Keys connections_keys;
218 config.keys("connections", connections_keys);
219
220 for (const auto & key : connections_keys)
221 {
222 std::string connection_key = "connections." + key;
223 auto connection_info = default_connection_info;
224 if (key.starts_with("host"))
225 {
226 connection_info.host = config.getString(connection_key);
227 connection_infos.push_back(std::move(connection_info));
228 }
229 else if (key.starts_with("connection") && key != "connection_timeout_ms")
230 {
231 connection_info.host = config.getString(connection_key + ".host");
232 if (config.has(connection_key + ".sessions"))
233 connection_info.sessions = config.getUInt64(connection_key + ".sessions");
234
235 fill_connection_details(connection_key, connection_info);
236
237 connection_infos.push_back(std::move(connection_info));
238 }
239 }
240}
241
242void Runner::thread(std::vector<std::shared_ptr<Coordination::ZooKeeper>> zookeepers, ThreadState & thread_state)
243{

Callers

nothing calls this directly

Calls 7

keysMethod · 0.80
hasMethod · 0.45
getBoolMethod · 0.45
getIntMethod · 0.45
getStringMethod · 0.45
push_backMethod · 0.45
getUInt64Method · 0.45

Tested by

no test coverage detected