| 80 | } |
| 81 | |
| 82 | int SharedLoadBalancer::Init(const char* lb_protocol) { |
| 83 | std::string lb_name; |
| 84 | butil::StringPiece lb_params; |
| 85 | if (!ParseParameters(lb_protocol, &lb_name, &lb_params)) { |
| 86 | LOG(FATAL) << "Fail to parse this load balancer protocol '" << lb_protocol << '\''; |
| 87 | return -1; |
| 88 | } |
| 89 | const LoadBalancer* lb = LoadBalancerExtension()->Find(lb_name.c_str()); |
| 90 | if (lb == NULL) { |
| 91 | LOG(FATAL) << "Fail to find LoadBalancer by `" << lb_name << "'"; |
| 92 | return -1; |
| 93 | } |
| 94 | _lb = lb->New(lb_params); |
| 95 | if (_lb == NULL) { |
| 96 | LOG(FATAL) << "Fail to new LoadBalancer"; |
| 97 | return -1; |
| 98 | } |
| 99 | if (FLAGS_show_lb_in_vars && !_exposed) { |
| 100 | ExposeLB(); |
| 101 | } |
| 102 | return 0; |
| 103 | } |
| 104 | |
| 105 | void SharedLoadBalancer::Describe(std::ostream& os, |
| 106 | const DescribeOptions& options) { |
nothing calls this directly
no test coverage detected