hashKey returns the hash key to use for an endpoint. Per gRFC A61, each entry in the ring is a hash of the endpoint's hash key concatenated with a per-entry unique suffix.
(endpoint resolver.Endpoint)
| 110 | // in the ring is a hash of the endpoint's hash key concatenated with a |
| 111 | // per-entry unique suffix. |
| 112 | func hashKey(endpoint resolver.Endpoint) string { |
| 113 | if hk := ringhash.HashKey(endpoint); hk != "" { |
| 114 | return hk |
| 115 | } |
| 116 | // If no hash key is set, use the endpoint's first address as the hash key. |
| 117 | // This is the default behavior when no hash key is set. |
| 118 | return endpoint.Addresses[0].Addr |
| 119 | } |
| 120 | |
| 121 | // UpdateState intercepts child balancer state updates. It updates the |
| 122 | // per-endpoint state stored in the ring, and also the aggregated state based on |