agent/engine/dependencygraph/graph.go
func verifyStatusResolvable(target *apicontainer.Container, existingContainers map[string]*apicontainer.Container,
	dependencies []string, resolves func(*apicontainer.Container, *apicontainer.Container) bool) bool {
	targetGoal := target.GetDesiredStatus()
	if targetGoal != target.GetSteadyStateStatus() && targetGoal != apicontainerstatus.ContainerCreated {
		// A container can always stop, die, or reach whatever other state it
		// wants regardless of what dependencies it has
		return true
	}

	for _, dependency := range dependencies {
		maybeResolves, exists := existingContainers[dependency]
		if !exists {
			return false
		}
		if !resolves(target, maybeResolves) {
			return false
		}
	}
	return true
}
func verifyStatusResolvable(target *apicontainer.Container, existingContainers map[string]*apicontainer.Container,
	dependencies []string, resolves func(*apicontainer.Container, *apicontainer.Container) bool) bool {
	targetGoal := target.GetDesiredStatus()
	if targetGoal != target.GetSteadyStateStatus() && targetGoal != apicontainerstatus.ContainerCreated {
		// A container can always stop, die, or reach whatever other state it
		// wants regardless of what dependencies it has
		return true
	}

	for _, dependency := range dependencies {
		maybeResolves, exists := existingContainers[dependency]
		if !exists {
			return false
		}
		if !resolves(target, maybeResolves) {
			return false
		}
	}
	return true
}
func verifyStatusResolvable ( target * apicontainer . Container , existingContainers map [ string ] * apicontainer . Container , dependencies [ ] string , resolves func ( * apicontainer . Container , * apicontainer . Container ) bool ) bool { targetGoal := target . GetDesiredStatus ( ) if targetGoal != target . GetSteadyStateStatus ( ) && targetGoal != apicontainerstatus . ContainerCreated { // A container can always stop, die, or reach whatever other state it // wants regardless of what dependencies it has return true } for _ , dependency := range dependencies { maybeResolves , exists := existingContainers [ dependency ] if ! exists { return false } if ! resolves ( target , maybeResolves ) { return false } } return true }
// verifyStatusResolvable validates that `target` can be resolved given that
// target depends on `dependencies` (which are container names) and there are
// `existingContainers` (map from name to container). The `resolves` function
// passed should return true if the named container is resolved.
verifyStatusResolvable validates that target can be resolved given that target depends on dependencies ( which are container names ) and there are existingContainers ( map from name to container ) . The resolves function passed should return true if the named container is resolved .