GetInstance return the InstanceDesc for the given instanceID or an error if the instance doesn't exist in the ring. The returned InstanceDesc is NOT a deep copy, so the caller should never modify it.
(instanceID string)
| 1256 | // if the instance doesn't exist in the ring. The returned InstanceDesc is NOT a |
| 1257 | // deep copy, so the caller should never modify it. |
| 1258 | func (r *Ring) GetInstance(instanceID string) (doNotModify InstanceDesc, _ error) { |
| 1259 | r.mtx.RLock() |
| 1260 | defer r.mtx.RUnlock() |
| 1261 | |
| 1262 | instances := r.ringDesc.GetIngesters() |
| 1263 | if instances == nil { |
| 1264 | return InstanceDesc{}, ErrInstanceNotFound |
| 1265 | } |
| 1266 | |
| 1267 | instance, ok := instances[instanceID] |
| 1268 | if !ok { |
| 1269 | return InstanceDesc{}, ErrInstanceNotFound |
| 1270 | } |
| 1271 | |
| 1272 | return instance, nil |
| 1273 | } |
| 1274 | |
| 1275 | // GetInstanceState returns the current state of an instance or an error if the |
| 1276 | // instance does not exist in the ring. |
no test coverage detected