backend

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package backend adapts the compose SDK for running many projects at once.

Index

Constants

This section is empty.

Variables

View Source
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 New

func New(opts Options) (*Backend, error)

New connects to the Docker engine described by the environment and Docker config.

func (*Backend) Client

func (b *Backend) Client() client.APIClient

Client is the Docker engine client 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.

func (*Backend) WithImageDigests

func (b *Backend) WithImageDigests(ctx context.Context, project *types.Project) (*types.Project, error)

WithImageDigests pins the project's image tags to their registry digests.

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.

Jump to

Keyboard shortcuts

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