2017-06-14 00:15:55 +00:00
|
|
|
package solver
|
|
|
|
|
|
|
|
import (
|
2017-06-22 20:15:46 +00:00
|
|
|
"github.com/moby/buildkit/client"
|
2017-07-10 20:03:38 +00:00
|
|
|
"github.com/moby/buildkit/exporter"
|
2017-08-25 20:08:18 +00:00
|
|
|
"github.com/moby/buildkit/frontend"
|
2017-06-22 20:15:46 +00:00
|
|
|
"github.com/moby/buildkit/solver/pb"
|
2017-07-31 22:06:59 +00:00
|
|
|
digest "github.com/opencontainers/go-digest"
|
2017-06-14 00:15:55 +00:00
|
|
|
"golang.org/x/net/context"
|
|
|
|
)
|
|
|
|
|
2017-12-13 07:39:37 +00:00
|
|
|
// Ref is a reference to the object passed through the build steps.
|
|
|
|
// This interface is a subset of the github.com/buildkit/buildkit/cache.Ref interface.
|
2017-11-06 06:30:16 +00:00
|
|
|
// For ease of unit testing, this interface only has Release().
|
2017-12-13 07:39:37 +00:00
|
|
|
type Ref interface {
|
2017-07-06 04:25:51 +00:00
|
|
|
Release(context.Context) error
|
|
|
|
}
|
|
|
|
|
|
|
|
// Op is an implementation for running a vertex
|
|
|
|
type Op interface {
|
2017-10-06 22:16:16 +00:00
|
|
|
// CacheKey returns a persistent cache key for operation.
|
2017-07-31 22:06:59 +00:00
|
|
|
CacheKey(context.Context) (digest.Digest, error)
|
2017-10-06 22:16:16 +00:00
|
|
|
// ContentMask returns a partial cache checksum with content paths to the
|
|
|
|
// inputs. User can combine the content checksum of these paths to get a valid
|
|
|
|
// content based cache key.
|
2017-10-06 00:34:45 +00:00
|
|
|
ContentMask(context.Context) (digest.Digest, [][]string, error)
|
2017-10-06 22:16:16 +00:00
|
|
|
// Run runs an operation and returns the output references.
|
2017-12-13 07:39:37 +00:00
|
|
|
Run(ctx context.Context, inputs []Ref) (outputs []Ref, err error)
|
2017-09-05 18:26:03 +00:00
|
|
|
}
|
|
|
|
|
2017-10-05 05:31:18 +00:00
|
|
|
type SolveRequest struct {
|
2017-10-13 18:54:26 +00:00
|
|
|
Definition *pb.Definition
|
|
|
|
Frontend frontend.Frontend
|
|
|
|
Exporter exporter.ExporterInstance
|
|
|
|
FrontendOpt map[string]string
|
|
|
|
ExportCacheRef string
|
|
|
|
ImportCacheRef string
|
2017-10-05 05:31:18 +00:00
|
|
|
}
|
|
|
|
|
2017-12-13 07:39:37 +00:00
|
|
|
type Solver interface {
|
|
|
|
Solve(ctx context.Context, id string, req SolveRequest) error
|
|
|
|
Status(ctx context.Context, id string, statusChan chan *client.SolveStatus) error
|
2017-07-06 20:15:54 +00:00
|
|
|
}
|