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_r273778076
 
 

 ##########
 File path: src/brpc/policy/consistent_hashing_load_balancer.h
 ##########
 @@ -56,14 +54,28 @@ class ConsistentHashingLoadBalancer : public LoadBalancer {
             return hash < code;
         }
     };
+    explicit ConsistentHashingLoadBalancer(ConsistentHashingLoadBalancerType 
type);
+    bool AddServer(const ServerId& server);
+    bool RemoveServer(const ServerId& server);
+    size_t AddServersInBatch(const std::vector<ServerId> &servers);
+    size_t RemoveServersInBatch(const std::vector<ServerId> &servers);
+    LoadBalancer *New(const butil::StringPiece& params) const;
+    void Destroy();
+    int SelectServer(const SelectIn &in, SelectOut *out);
+    void Describe(std::ostream &os, const DescribeOptions& options);
+
+private:
+    bool SetParameters(const butil::StringPiece& params);
+    void GetLoads(std::map<butil::EndPoint, double> *load_map);
     static size_t AddBatch(std::vector<Node> &bg, const std::vector<Node> &fg,
                            const std::vector<Node> &servers, bool *executed);
     static size_t RemoveBatch(std::vector<Node> &bg, const std::vector<Node> 
&fg,
                               const std::vector<ServerId> &servers, bool 
*executed);
     static size_t Remove(std::vector<Node> &bg, const std::vector<Node> &fg,
                          const ServerId& server, bool *executed);
-    HashFunc _hash;
+    const ReplicaPolicy* _replicas_policy;
     size_t _num_replicas;
+    ConsistentHashingLoadBalancerType _type;
 
 Review comment:
   也不行,这是在C++ dynamic initialize的时候做的,其它初始化在它初始化前调用channel.Init,就挂了

----------------------------------------------------------------
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]

Reply via email to