| 66 | } |
| 67 | |
| 68 | type LoadBalancedPool struct { |
| 69 | lock sync.RWMutex |
| 70 | |
| 71 | // Maps "host:port" -> instancePool. |
| 72 | instances map[string]*instancePool |
| 73 | instanceList instancePoolSlice |
| 74 | |
| 75 | // shuffleSeed is used for shuffle sorting |
| 76 | shuffleSeed int |
| 77 | // hashSeed is used for consistent hashing |
| 78 | hashSeed uint32 |
| 79 | // hashFunction is used for consistent hashing |
| 80 | hashFunction ConsistentHashFunc |
| 81 | // instanceHashes stores the hashes for the instances. |
| 82 | instanceHashes []uint32 |
| 83 | |
| 84 | // Atomic counter that is used for round robining instances |
| 85 | // from instanceList. |
| 86 | instanceIdx uint64 |
| 87 | |
| 88 | // Number of instances to round-robin between |
| 89 | activeSetSize uint64 |
| 90 | |
| 91 | // How long to mark a server unusable for. |
| 92 | markDownDuration time.Duration |
| 93 | |
| 94 | // UNIX epoch time in seconds that represents time till address is considered |
| 95 | // as down and unusable. |
| 96 | markDownUntil []int64 |
| 97 | |
| 98 | params ConnectionParams // Parameters for creating SimplePool-s. |
| 99 | strategy LBStrategy // Load balancing strategy. |
| 100 | } |
| 101 | |
| 102 | type instancePool struct { |
| 103 | SimplePool |
nothing calls this directly
no outgoing calls
no test coverage detected