(id ID)
| 139 | } |
| 140 | |
| 141 | func (m *Manager) IsReady(id ID) (bool, error) { |
| 142 | if id == "" { |
| 143 | return false, xerrors.Errorf("unit ID cannot be empty: %w", ErrUnitIDRequired) |
| 144 | } |
| 145 | |
| 146 | m.mu.RLock() |
| 147 | defer m.mu.RUnlock() |
| 148 | |
| 149 | if !m.registered(id) { |
| 150 | return true, nil |
| 151 | } |
| 152 | |
| 153 | return m.units[id].ready, nil |
| 154 | } |
| 155 | |
| 156 | // AddDependency adds a dependency relationship between units. |
| 157 | // The unit depends on the dependsOn unit reaching the requiredStatus. |