recalculateReadinessUnsafe recalculates the readiness state for a unit. This method assumes the caller holds the write lock.
(unit ID)
| 215 | // recalculateReadinessUnsafe recalculates the readiness state for a unit. |
| 216 | // This method assumes the caller holds the write lock. |
| 217 | func (m *Manager) recalculateReadinessUnsafe(unit ID) { |
| 218 | u := m.units[unit] |
| 219 | dependencies := m.graph.GetForwardAdjacentVertices(unit) |
| 220 | |
| 221 | allSatisfied := true |
| 222 | for _, dependency := range dependencies { |
| 223 | requiredStatus := dependency.Edge |
| 224 | dependsOnUnit := m.units[dependency.To] |
| 225 | if dependsOnUnit.status != requiredStatus { |
| 226 | allSatisfied = false |
| 227 | break |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | u.ready = allSatisfied |
| 232 | m.units[unit] = u |
| 233 | } |
| 234 | |
| 235 | // GetGraph returns the underlying graph for visualization and debugging. |
| 236 | // This should be used carefully as it exposes the internal graph structure. |
no test coverage detected