ServicesByState provides a snapshot of the current state of all the services under management.
()
| 160 | |
| 161 | // ServicesByState provides a snapshot of the current state of all the services under management. |
| 162 | func (m *Manager) ServicesByState() map[State][]Service { |
| 163 | m.mu.Lock() |
| 164 | defer m.mu.Unlock() |
| 165 | |
| 166 | result := map[State][]Service{} |
| 167 | for st, ss := range m.byState { |
| 168 | result[st] = append([]Service(nil), ss...) // make a copy |
| 169 | } |
| 170 | return result |
| 171 | } |
| 172 | |
| 173 | func (m *Manager) serviceStateChanged(s Service, from State, to State) { |
| 174 | m.mu.Lock() |
no outgoing calls