Documentation
¶
Index ¶
- type ConstraintSolver
- type CookbookNode
- type DefaultResolver
- type DependencyGraph
- func (g *DependencyGraph) AddCookbook(cookbook *berkshelf.Cookbook) *CookbookNode
- func (g *DependencyGraph) AddDependency(from, to *CookbookNode, constraint *berkshelf.Constraint)
- func (g *DependencyGraph) AllCookbooks() []*CookbookNode
- func (g *DependencyGraph) Clone() *DependencyGraph
- func (g *DependencyGraph) EdgeCount() int
- func (g *DependencyGraph) GetCookbook(name string) (*CookbookNode, bool)
- func (g *DependencyGraph) GetCycles() [][]string
- func (g *DependencyGraph) GetDependencies(node *CookbookNode) []*CookbookNode
- func (g *DependencyGraph) GetDependents(node *CookbookNode) []*CookbookNode
- func (g *DependencyGraph) HasCycles() bool
- func (g *DependencyGraph) HasDependency(from, to *CookbookNode) bool
- func (g *DependencyGraph) NodeCount() int
- func (g *DependencyGraph) TopologicalSort() ([]*CookbookNode, error)
- type Requirement
- type Resolution
- func (r *Resolution) AddCookbook(cookbook *ResolvedCookbook)
- func (r *Resolution) AddError(err error)
- func (r *Resolution) AllCookbooks() []*ResolvedCookbook
- func (r *Resolution) CookbookCount() int
- func (r *Resolution) GetCookbook(name string) (*ResolvedCookbook, bool)
- func (r *Resolution) HasCookbook(name string) bool
- func (r *Resolution) HasErrors() bool
- type ResolutionCache
- func (c *ResolutionCache) Clear()
- func (c *ResolutionCache) GetMetadata(key string) *berkshelf.Cookbook
- func (c *ResolutionCache) GetVersions(key string) []*berkshelf.Version
- func (c *ResolutionCache) SetMetadata(key string, cookbook *berkshelf.Cookbook)
- func (c *ResolutionCache) SetVersions(key string, versions []*berkshelf.Version)
- type ResolvedCookbook
- type Resolver
- type SolverState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConstraintSolver ¶
type ConstraintSolver struct {
// contains filtered or unexported fields
}
ConstraintSolver implements a more sophisticated dependency resolution algorithm that can handle conflicting constraints and backtracking
func NewConstraintSolver ¶
func NewConstraintSolver(sources []source.CookbookSource) *ConstraintSolver
NewConstraintSolver creates a new constraint solver
func (*ConstraintSolver) Solve ¶
func (cs *ConstraintSolver) Solve(ctx context.Context, requirements []*Requirement) (*Resolution, error)
Solve attempts to find a solution that satisfies all constraints
type CookbookNode ¶
type CookbookNode struct {
Name string
Version *berkshelf.Version
Cookbook *berkshelf.Cookbook
Resolved bool
// contains filtered or unexported fields
}
CookbookNode represents a cookbook in the dependency graph
func (*CookbookNode) String ¶
func (n *CookbookNode) String() string
String returns a string representation of the cookbook node
type DefaultResolver ¶
type DefaultResolver struct {
// contains filtered or unexported fields
}
DefaultResolver implements the Resolver interface
func NewResolver ¶
func NewResolver(sources []source.CookbookSource) *DefaultResolver
NewResolver creates a new resolver with the given sources
func (*DefaultResolver) Resolve ¶
func (r *DefaultResolver) Resolve(ctx context.Context, requirements []*Requirement) (*Resolution, error)
Resolve implements concurrent I/O operations for dependency resolution
func (*DefaultResolver) SetMaxWorkers ¶
func (r *DefaultResolver) SetMaxWorkers(workers int)
SetMaxWorkers configures the number of concurrent workers for I/O operations
type DependencyGraph ¶
type DependencyGraph struct {
// contains filtered or unexported fields
}
DependencyGraph represents cookbook dependencies using gonum's graph
func NewDependencyGraph ¶
func NewDependencyGraph() *DependencyGraph
NewDependencyGraph creates a new dependency graph
func (*DependencyGraph) AddCookbook ¶
func (g *DependencyGraph) AddCookbook(cookbook *berkshelf.Cookbook) *CookbookNode
AddCookbook adds a cookbook to the graph
func (*DependencyGraph) AddDependency ¶
func (g *DependencyGraph) AddDependency(from, to *CookbookNode, constraint *berkshelf.Constraint)
AddDependency adds a dependency edge between cookbooks
func (*DependencyGraph) AllCookbooks ¶
func (g *DependencyGraph) AllCookbooks() []*CookbookNode
AllCookbooks returns all cookbook nodes in the graph
func (*DependencyGraph) Clone ¶
func (g *DependencyGraph) Clone() *DependencyGraph
Clone creates a deep copy of the dependency graph
func (*DependencyGraph) EdgeCount ¶
func (g *DependencyGraph) EdgeCount() int
EdgeCount returns the number of dependency relationships in the graph
func (*DependencyGraph) GetCookbook ¶
func (g *DependencyGraph) GetCookbook(name string) (*CookbookNode, bool)
GetCookbook retrieves a cookbook node by name
func (*DependencyGraph) GetCycles ¶
func (g *DependencyGraph) GetCycles() [][]string
GetCycles returns any circular dependencies found in the graph
func (*DependencyGraph) GetDependencies ¶
func (g *DependencyGraph) GetDependencies(node *CookbookNode) []*CookbookNode
GetDependencies returns all direct dependencies of a cookbook
func (*DependencyGraph) GetDependents ¶
func (g *DependencyGraph) GetDependents(node *CookbookNode) []*CookbookNode
GetDependents returns all cookbooks that depend on the given cookbook
func (*DependencyGraph) HasCycles ¶
func (g *DependencyGraph) HasCycles() bool
HasCycles checks if the dependency graph has circular dependencies
func (*DependencyGraph) HasDependency ¶
func (g *DependencyGraph) HasDependency(from, to *CookbookNode) bool
HasDependency checks if a dependency exists between two cookbooks
func (*DependencyGraph) NodeCount ¶
func (g *DependencyGraph) NodeCount() int
NodeCount returns the number of cookbooks in the graph
func (*DependencyGraph) TopologicalSort ¶
func (g *DependencyGraph) TopologicalSort() ([]*CookbookNode, error)
TopologicalSort returns cookbooks in dependency order
type Requirement ¶
type Requirement struct {
Name string
Constraint *berkshelf.Constraint
Source *berkshelf.SourceLocation
}
Requirement represents a cookbook requirement to be resolved
func NewRequirement ¶
func NewRequirement(name string, constraint *berkshelf.Constraint) *Requirement
NewRequirement creates a new requirement
func NewRequirementWithSource ¶
func NewRequirementWithSource(name string, constraint *berkshelf.Constraint, source *berkshelf.SourceLocation) *Requirement
NewRequirementWithSource creates a new requirement with a specific source
func (*Requirement) String ¶
func (r *Requirement) String() string
String returns a string representation of the requirement
type Resolution ¶
type Resolution struct {
Graph *DependencyGraph
Cookbooks map[string]*ResolvedCookbook
Errors []error
}
Resolution represents a resolved dependency graph
func (*Resolution) AddCookbook ¶
func (r *Resolution) AddCookbook(cookbook *ResolvedCookbook)
AddCookbook adds a resolved cookbook to the resolution
func (*Resolution) AddError ¶
func (r *Resolution) AddError(err error)
AddError adds an error to the resolution
func (*Resolution) AllCookbooks ¶
func (r *Resolution) AllCookbooks() []*ResolvedCookbook
AllCookbooks returns all resolved cookbooks
func (*Resolution) CookbookCount ¶
func (r *Resolution) CookbookCount() int
CookbookCount returns the number of resolved cookbooks
func (*Resolution) GetCookbook ¶
func (r *Resolution) GetCookbook(name string) (*ResolvedCookbook, bool)
GetCookbook retrieves a resolved cookbook by name
func (*Resolution) HasCookbook ¶
func (r *Resolution) HasCookbook(name string) bool
HasCookbook checks if a cookbook is in the resolution
func (*Resolution) HasErrors ¶
func (r *Resolution) HasErrors() bool
HasErrors returns true if the resolution has any errors
type ResolutionCache ¶
type ResolutionCache struct {
// contains filtered or unexported fields
}
ResolutionCache caches cookbook metadata and available versions
func NewResolutionCache ¶
func NewResolutionCache() *ResolutionCache
NewResolutionCache creates a new resolution cache
func (*ResolutionCache) GetMetadata ¶
func (c *ResolutionCache) GetMetadata(key string) *berkshelf.Cookbook
GetMetadata retrieves cookbook metadata from cache
func (*ResolutionCache) GetVersions ¶
func (c *ResolutionCache) GetVersions(key string) []*berkshelf.Version
GetVersions retrieves versions from cache
func (*ResolutionCache) SetMetadata ¶
func (c *ResolutionCache) SetMetadata(key string, cookbook *berkshelf.Cookbook)
SetMetadata stores cookbook metadata in cache
func (*ResolutionCache) SetVersions ¶
func (c *ResolutionCache) SetVersions(key string, versions []*berkshelf.Version)
SetVersions stores versions in cache
type ResolvedCookbook ¶
type ResolvedCookbook struct {
Name string
Version *berkshelf.Version
Source *berkshelf.SourceLocation
SourceRef source.CookbookSource // Reference to the actual source object
Dependencies map[string]*berkshelf.Version
Cookbook *berkshelf.Cookbook
}
ResolvedCookbook represents a cookbook that has been resolved
type Resolver ¶
type Resolver interface {
Resolve(ctx context.Context, requirements []*Requirement) (*Resolution, error)
}
Resolver defines the interface for dependency resolution
type SolverState ¶
type SolverState struct {
// contains filtered or unexported fields
}
SolverState represents the current state of the resolution process