MCPcopy Create free account
hub / github.com/apache/brpc / SetParameters

Method SetParameters

src/brpc/policy/consistent_hashing_load_balancer.cpp:392–408  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

390}
391
392bool ConsistentHashingLoadBalancer::SetParameters(const butil::StringPiece& params) {
393 for (butil::KeyValuePairsSplitter sp(params.begin(), params.end(), ' ', '=');
394 sp; ++sp) {
395 if (sp.value().empty()) {
396 LOG(ERROR) << "Empty value for " << sp.key() << " in lb parameter";
397 return false;
398 }
399 if (sp.key() == "replicas") {
400 if (!butil::StringToSizeT(sp.value(), &_num_replicas)) {
401 return false;
402 }
403 continue;
404 }
405 LOG(ERROR) << "Failed to set this unknown parameters " << sp.key_and_value();
406 }
407 return true;
408}
409
410} // namespace policy
411} // namespace brpc

Callers 1

NewMethod · 0.45

Calls 7

StringToSizeTFunction · 0.85
beginMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45
valueMethod · 0.45
keyMethod · 0.45
key_and_valueMethod · 0.45

Tested by

no test coverage detected