FilterParents returns the parents of a certain vertex that are in a certain status
(key string, status ServiceStatus)
| 386 | |
| 387 | // FilterParents returns the parents of a certain vertex that are in a certain status |
| 388 | func (g *Graph) FilterParents(key string, status ServiceStatus) []*Vertex { |
| 389 | g.lock.Lock() |
| 390 | defer g.lock.Unlock() |
| 391 | |
| 392 | var res []*Vertex |
| 393 | vertex := g.Vertices[key] |
| 394 | |
| 395 | for _, parent := range vertex.Parents { |
| 396 | if parent.Status == status { |
| 397 | res = append(res, parent) |
| 398 | } |
| 399 | } |
| 400 | |
| 401 | return res |
| 402 | } |
| 403 | |
| 404 | // HasCycles detects cycles in the graph |
| 405 | func (g *Graph) HasCycles() (bool, error) { |