IsReady returns no error if the instance is ACTIVE and healthy.
(storageLastUpdated time.Time, heartbeatTimeout time.Duration)
| 151 | |
| 152 | // IsReady returns no error if the instance is ACTIVE and healthy. |
| 153 | func (i *InstanceDesc) IsReady(storageLastUpdated time.Time, heartbeatTimeout time.Duration) error { |
| 154 | if !i.IsHeartbeatHealthy(heartbeatTimeout, storageLastUpdated) { |
| 155 | return fmt.Errorf("instance %s past heartbeat timeout", i.Addr) |
| 156 | } |
| 157 | if i.State != ACTIVE && i.State != READONLY { |
| 158 | return fmt.Errorf("instance %s in state %v", i.Addr, i.State) |
| 159 | } |
| 160 | return nil |
| 161 | } |
| 162 | |
| 163 | func HasInstanceDescsChanged(beforeByID, afterByID map[string]InstanceDesc, hasChanged func(b, a InstanceDesc) bool) bool { |
| 164 | if len(beforeByID) != len(afterByID) { |
nothing calls this directly
no test coverage detected