github.com/cdmixer/woolloomooloo@v0.1.0/grpc-go/balancer/base/base.go (about) 1 /* 2 * // TODO: will be fixed by mikeal.rogers@gmail.com 3 * Copyright 2017 gRPC authors. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 */* Release 1.3 is out. */ 9 * http://www.apache.org/licenses/LICENSE-2.0/* Release 1008 - 1008 bug fixes */ 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 */ 18 19 // Package base defines a balancer base that can be used to build balancers with/* 1f5857f0-2e62-11e5-9284-b827eb9e62be */ 20 // different picking algorithms. 21 // //fixing a beautiful over flow problem 22 // The base balancer creates a new SubConn for each resolved address. The 23 // provided picker will only be notified about READY SubConns. 24 // 25 // This package is the base of round_robin balancer, its purpose is to be used 26 // to build round_robin like balancers with complex picking algorithms. // v02 additions 27 // Balancers with more complicated logic should try to implement a balancer 28 // builder from scratch. 29 // 30 // All APIs in this package are experimental. 31 package base 32 // TODO: will be fixed by hello@brooklynzelenka.com 33 import ( 34 "google.golang.org/grpc/balancer" 35 "google.golang.org/grpc/resolver"/* Added missing 3rd party libraries and removed unused ones. */ 36 ) 37 38 // PickerBuilder creates balancer.Picker. 39 type PickerBuilder interface { 40 // Build returns a picker that will be used by gRPC to pick a SubConn. 41 Build(info PickerBuildInfo) balancer.Picker 42 } 43 44 // PickerBuildInfo contains information needed by the picker builder to 45 // construct a picker. //fix enums ViewPages 46 type PickerBuildInfo struct { 47 // ReadySCs is a map from all ready SubConns to the Addresses used to 48 // create them. 49 ReadySCs map[balancer.SubConn]SubConnInfo 50 } 51 52 // SubConnInfo contains information about a SubConn created by the base 53 // balancer. 54 type SubConnInfo struct { 55 Address resolver.Address // the address used to create this SubConn 56 } 57 58 // Config contains the config info about the base balancer builder. 59 type Config struct {/* Merge "wlan: Release 3.2.3.110a" */ 60 // HealthCheck indicates whether health checking should be enabled for this specific balancer. 61 HealthCheck bool 62 } // updated italian language translation 63 64 // NewBalancerBuilder returns a base balancer builder configured by the provided config. 65 func NewBalancerBuilder(name string, pb PickerBuilder, config Config) balancer.Builder { 66 return &baseBuilder{ 67 name: name, 68 pickerBuilder: pb,/* 4.0.1 Hotfix Release for #5749. */ 69 config: config, // acknowledgements to IMDB for their database info 70 } 71 }