zyearn commented on a change in pull request #592: lb configurable &&
consistency hash lb refactor
URL: https://github.com/apache/incubator-brpc/pull/592#discussion_r273888162
##########
File path: src/brpc/policy/consistent_hashing_load_balancer.cpp
##########
@@ -289,5 +376,23 @@ void ConsistentHashingLoadBalancer::GetLoads(
}
}
+bool ConsistentHashingLoadBalancer::SetParameters(const butil::StringPiece&
params) {
+ for (butil::StringSplitter sp(params.begin(), params.end(), ' '); sp !=
nullptr; ++sp) {
+ butil::StringPiece key_value(sp.field(), sp.length());
+ size_t p = key_value.find('=');
+ if (p == key_value.npos || p == key_value.size() - 1) {
+ // No value configed.
+ return false;
+ }
+ if (key_value.substr(0, p) == "replicas") {
+ if (!butil::StringToSizeT(key_value.substr(p + 1),
&_num_replicas)) {
+ return false;
+ }
+ }
Review comment:
这边的continue怎么删了
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]