Documentation
¶
Overview ¶
Package backend adapts the compose SDK for running many projects at once.
Index ¶
- Variables
- type Backend
- func (b *Backend) Client() client.APIClient
- func (b *Backend) LoadModel(ctx context.Context, t discover.Target, fns ...cli.ProjectOptionsFn) (map[string]any, error)
- func (b *Backend) LoadProject(ctx context.Context, t discover.Target, services ...string) (*types.Project, error)
- func (b *Backend) LoadProjectWith(ctx context.Context, t discover.Target, fns []cli.ProjectOptionsFn, ...) (*types.Project, error)
- func (b *Backend) Service(events api.EventProcessor, prompt compose.Prompt, extra ...compose.Option) (api.Compose, error)
- func (b *Backend) WithImageDigests(ctx context.Context, project *types.Project) (*types.Project, error)
- type Options
- type Resolution
- type Selection
Constants ¶
This section is empty.
Variables ¶
var ErrNoMatchingServices = errors.New("no project defines the requested services")
ErrNoMatchingServices is returned when services were requested but no project defines any of them.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend holds a single Docker CLI shared by all targets.
func (*Backend) LoadModel ¶
func (b *Backend) LoadModel(ctx context.Context, t discover.Target, fns ...cli.ProjectOptionsFn) (map[string]any, error)
LoadModel loads the target's compose model as a raw map, without building a project from it, so options such as skipping interpolation keep the file's own values.
func (*Backend) LoadProject ¶
func (b *Backend) LoadProject(ctx context.Context, t discover.Target, services ...string) (*types.Project, error)
LoadProject loads the target's compose project. When services are given, the project is narrowed to them and their dependencies and the profiles they need are enabled.
func (*Backend) LoadProjectWith ¶
func (b *Backend) LoadProjectWith(ctx context.Context, t discover.Target, fns []cli.ProjectOptionsFn, services ...string) (*types.Project, error)
LoadProjectWith is LoadProject with extra compose-go loader options.
func (*Backend) Service ¶
func (b *Backend) Service(events api.EventProcessor, prompt compose.Prompt, extra ...compose.Option) (api.Compose, error)
Service returns a compose service dedicated to one target, reporting progress to events and asking questions through prompt. Extra options are applied last.
type Options ¶
type Options struct {
Profiles []string
EnvFiles []string
Parallel int
Compatibility bool
DryRun bool
AllResources bool
}
Options are the compose-level settings shared by every target.
type Resolution ¶
type Resolution struct {
Selections []Selection
// Missing lists requested names that no project defines.
Missing []string
}
Resolution holds one Selection per project, in input order.
func ResolveServices ¶
func ResolveServices(requested []string, projects []*types.Project) (Resolution, error)
ResolveServices intersects the requested service names with each project's services. A service in a disabled profile still counts as defined. Without requested names every project is selected whole. It returns ErrNoMatchingServices only when no project matched anything.
type Selection ¶
type Selection struct {
// Services are the requested names the project defines; empty means the whole project.
Services []string
// Skip is set when services were requested but the project defines none of them.
Skip bool
}
Selection is the outcome of resolving requested services against one project.