mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
vendor: buildkit, docker/docker and docker/cli v27.0.1
diffs: - https://github.com/docker/cli/compare/v26.1.4..v27.0.1 - https://github.com/docker/docker/compare/v26.1.4..v27.0.1 - https://github.com/moby/buildkit/compare/v0.14.1...aaaf86e5470bffbb395f5c15ad4a1c152642ea30 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
62
vendor/github.com/moby/buildkit/client/llb/async.go
generated
vendored
62
vendor/github.com/moby/buildkit/client/llb/async.go
generated
vendored
@ -6,16 +6,12 @@ import (
|
||||
"github.com/moby/buildkit/solver/pb"
|
||||
"github.com/moby/buildkit/util/flightcontrol"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
type asyncState struct {
|
||||
f func(context.Context, State, *Constraints) (State, error)
|
||||
prev State
|
||||
target State
|
||||
set bool
|
||||
err error
|
||||
g flightcontrol.Group[State]
|
||||
f func(context.Context, State, *Constraints) (State, error)
|
||||
prev State
|
||||
g flightcontrol.CachedGroup[State]
|
||||
}
|
||||
|
||||
func (as *asyncState) Output() Output {
|
||||
@ -23,59 +19,33 @@ func (as *asyncState) Output() Output {
|
||||
}
|
||||
|
||||
func (as *asyncState) Vertex(ctx context.Context, c *Constraints) Vertex {
|
||||
err := as.Do(ctx, c)
|
||||
target, err := as.Do(ctx, c)
|
||||
if err != nil {
|
||||
return &errVertex{err}
|
||||
}
|
||||
if as.set {
|
||||
out := as.target.Output()
|
||||
if out == nil {
|
||||
return nil
|
||||
}
|
||||
return out.Vertex(ctx, c)
|
||||
out := target.Output()
|
||||
if out == nil {
|
||||
return nil
|
||||
}
|
||||
return nil
|
||||
return out.Vertex(ctx, c)
|
||||
}
|
||||
|
||||
func (as *asyncState) ToInput(ctx context.Context, c *Constraints) (*pb.Input, error) {
|
||||
err := as.Do(ctx, c)
|
||||
target, err := as.Do(ctx, c)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if as.set {
|
||||
out := as.target.Output()
|
||||
if out == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return out.ToInput(ctx, c)
|
||||
out := target.Output()
|
||||
if out == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return nil, nil
|
||||
return out.ToInput(ctx, c)
|
||||
}
|
||||
|
||||
func (as *asyncState) Do(ctx context.Context, c *Constraints) error {
|
||||
_, err := as.g.Do(ctx, "", func(ctx context.Context) (State, error) {
|
||||
if as.set {
|
||||
return as.target, as.err
|
||||
}
|
||||
res, err := as.f(ctx, as.prev, c)
|
||||
if err != nil {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
if errors.Is(err, context.Cause(ctx)) {
|
||||
return res, err
|
||||
}
|
||||
default:
|
||||
}
|
||||
}
|
||||
as.target = res
|
||||
as.err = err
|
||||
as.set = true
|
||||
return res, err
|
||||
func (as *asyncState) Do(ctx context.Context, c *Constraints) (State, error) {
|
||||
return as.g.Do(ctx, "", func(ctx context.Context) (State, error) {
|
||||
return as.f(ctx, as.prev, c)
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return as.err
|
||||
}
|
||||
|
||||
type errVertex struct {
|
||||
|
Reference in New Issue
Block a user