Documentation
¶
Overview ¶
Package composition validates component membership in named compositions.
A composition groups multiple services into one system. Components join a composition via their first-class `composition:` field. Membership is a closed contract (a component may only claim a service the composition declares) but fulfillment is open (a declared service with no component in a given stack is allowed).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecuteValidate ¶
ExecuteValidate produces a soft report of which composition services are fulfilled and which are not provided in a stack, and surfaces any unknown members (which are hard errors enforced during component execution).
func ValidateMembership ¶
func ValidateMembership(componentName, compositionName string, compositions map[string]schema.Composition) error
ValidateMembership checks that a component claiming membership in a composition is allowed: the composition must exist and must declare the component's name in its services list. Returns a hard error otherwise. An empty composition name is valid (no membership).
Types ¶
type Report ¶
type Report struct {
Composition string
Description string
Fulfilled []string // declared services that a component provides in this stack
NotProvided []string // declared services with no component in this stack
Unknown []string // members claimed by components but not declared (hard errors)
}
Report describes which declared services of a composition are fulfilled by components in a stack and which are not provided there.
func Validate ¶
func Validate(compositionName string, members []string, compositions map[string]schema.Composition) (Report, error)
Validate builds a soft Report for a composition given the set of component names that claim membership in it within a stack. Members not declared by the composition are surfaced in Unknown (these are hard errors elsewhere).