MCPcopy
hub / github.com/docker/compose / InDependencyOrder

Function InDependencyOrder

pkg/compose/dependencies.go:79–89  ·  pkg/compose/dependencies.go::InDependencyOrder

InDependencyOrder applies the function to the services of the project taking in account the dependency order

(ctx context.Context, project *types.Project, fn func(context.Context, string) error, options ...func(*graphTraversal))

Source from the content-addressed store, hash-verified

77
78// InDependencyOrder applies the function to the services of the project taking in account the dependency order
79func InDependencyOrder(ctx context.Context, project *types.Project, fn func(context.Context, string) error, options ...func(*graphTraversal)) error {
80 graph, err := NewGraph(project, ServiceStopped)
81 if err != nil {
82 return err
83 }
84 t := upDirectionTraversal(fn)
85 for _, option := range options {
86 option(t)
87 }
88 return t.visit(ctx, graph)
89}
90
91// InReverseDependencyOrder applies the function to the services of the project in reverse order of dependencies
92func InReverseDependencyOrder(ctx context.Context, project *types.Project, fn func(context.Context, string) error, options ...func(*graphTraversal)) error {

Callers 5

startMethod · 0.85
restartMethod · 0.85
doBuildClassicMethod · 0.85

Calls 3

NewGraphFunction · 0.85
upDirectionTraversalFunction · 0.85
visitMethod · 0.45

Tested by 2