package graph

import "github.com/compose-spec/compose-go/v2/graph"

Index

Functions

func CheckCycle

func CheckCycle(project *types.Project) error

CheckCycle analyze project's depends_on relation and report an error on cycle detection

func CollectInDependencyOrder

func CollectInDependencyOrder[T any](ctx context.Context, project *types.Project, fn CollectorFn[types.ServiceConfig, T], options ...func(*Options)) (map[string]T, error)

CollectInDependencyOrder walk the service graph an invoke CollectorFn in respect to dependency order, then return result for each call

func InDependencyOrder

func InDependencyOrder(ctx context.Context, project *types.Project, fn VisitorFn[types.ServiceConfig], options ...func(*Options)) error

InDependencyOrder walk the service graph an invoke VisitorFn in respect to dependency order

func InReverseOrder

func InReverseOrder(o *Options)

InReverseOrder configure traversal to walk the graph in reverse dependency order

func WithMaxConcurrency

func WithMaxConcurrency(max int) func(*Options)

WithMaxConcurrency configure traversal to limit concurrency walking graph nodes

func WithRootNodesAndDown

func WithRootNodesAndDown(nodes []string) func(*Options)

WithRootNodesAndDown creates a graphTraversal to start from selected nodes

Types

type CollectorFn

type CollectorFn[S any, T any] func(context.Context, string, S) (T, error)

CollectorFn executes on each graph vertex based on visit order and return associated value

type Options

type Options struct {
	// contains filtered or unexported fields
}

type VisitorFn

type VisitorFn[S any] func(context.Context, string, S) error

VisitorFn executes on each graph nodes based on visit order

Source Files

cycle.go graph.go services.go traversal.go

Version
v2.4.8 (latest)
Published
Feb 10, 2025
Platform
linux/amd64
Imports
8 packages
Last checked
2 months ago

Tools for package owners.