dependency

package
v0.21.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package dependency provides service dependency graph management for Docker Compose projects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ServiceDependencyGraph

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

ServiceDependencyGraph models dependencies between services using adjacency maps. Edge direction: dependency -> dependent (i.e., B -> A means A depends on B).

func BuildServiceDependencyGraph

func BuildServiceDependencyGraph(project *types.Project) (*ServiceDependencyGraph, error)

BuildServiceDependencyGraph builds a dependency graph for all services in a project.

func NewServiceDependencyGraph

func NewServiceDependencyGraph() *ServiceDependencyGraph

NewServiceDependencyGraph creates a new, empty dependency graph.

func (*ServiceDependencyGraph) AddDependency

func (sdg *ServiceDependencyGraph) AddDependency(dependent, dependency string) error

AddDependency adds a dependency relationship where `dependent` depends on `dependency`. This creates an edge: dependency -> dependent.

func (*ServiceDependencyGraph) AddService

func (sdg *ServiceDependencyGraph) AddService(serviceName string) error

AddService ensures a service exists in the graph.

func (*ServiceDependencyGraph) GetDependencies

func (sdg *ServiceDependencyGraph) GetDependencies(serviceName string) ([]string, error)

GetDependencies returns the services that the given service depends on.

func (*ServiceDependencyGraph) GetDependents

func (sdg *ServiceDependencyGraph) GetDependents(serviceName string) ([]string, error)

GetDependents returns the services that depend on the given service.

func (*ServiceDependencyGraph) GetTopologicalOrder

func (sdg *ServiceDependencyGraph) GetTopologicalOrder() ([]string, error)

GetTopologicalOrder returns services in topological order (dependencies first). Kahn's algorithm with deterministic tie-breaking (lexical).

func (*ServiceDependencyGraph) HasCycles

func (sdg *ServiceDependencyGraph) HasCycles() bool

HasCycles checks if the dependency graph contains cycles.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL