"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "components/cli/vendor/github.com/moby/buildkit/session/filesync/filesync.go" between
docker-ce-19.03.2.tar.gz and docker-ce-19.03.3.tar.gz

About: Docker CE is a project to pack, ship and run any application as a lightweight container. Docker containers can run anywhere, on a laptop or at scale, in production, on VMs, bare metal, OpenStack clusters, public clouds and more. Community edition.

filesync.go  (docker-ce-19.03.2):filesync.go  (docker-ce-19.03.3)
skipping to change at line 21 skipping to change at line 21
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/tonistiigi/fsutil" "github.com/tonistiigi/fsutil"
fstypes "github.com/tonistiigi/fsutil/types" fstypes "github.com/tonistiigi/fsutil/types"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata" "google.golang.org/grpc/metadata"
"google.golang.org/grpc/status" "google.golang.org/grpc/status"
) )
const ( const (
keyOverrideExcludes = "override-excludes" keyOverrideExcludes = "override-excludes"
keyIncludePatterns = "include-patterns" keyIncludePatterns = "include-patterns"
keyExcludePatterns = "exclude-patterns" keyExcludePatterns = "exclude-patterns"
keyFollowPaths = "followpaths" keyFollowPaths = "followpaths"
keyDirName = "dir-name" keyDirName = "dir-name"
keyExporterMetaPrefix = "exporter-md-"
) )
type fsSyncProvider struct { type fsSyncProvider struct {
dirs map[string]SyncedDir dirs map[string]SyncedDir
p progressCb p progressCb
doneCh chan error doneCh chan error
} }
type SyncedDir struct { type SyncedDir struct {
Name string Name string
skipping to change at line 241 skipping to change at line 242
// NewFSSyncTargetDir allows writing into a directory // NewFSSyncTargetDir allows writing into a directory
func NewFSSyncTargetDir(outdir string) session.Attachable { func NewFSSyncTargetDir(outdir string) session.Attachable {
p := &fsSyncTarget{ p := &fsSyncTarget{
outdir: outdir, outdir: outdir,
} }
return p return p
} }
// NewFSSyncTarget allows writing into an io.WriteCloser // NewFSSyncTarget allows writing into an io.WriteCloser
func NewFSSyncTarget(w io.WriteCloser) session.Attachable { func NewFSSyncTarget(f func(map[string]string) (io.WriteCloser, error)) session. Attachable {
p := &fsSyncTarget{ p := &fsSyncTarget{
outfile: w, f: f,
} }
return p return p
} }
type fsSyncTarget struct { type fsSyncTarget struct {
outdir string outdir string
outfile io.WriteCloser f func(map[string]string) (io.WriteCloser, error)
} }
func (sp *fsSyncTarget) Register(server *grpc.Server) { func (sp *fsSyncTarget) Register(server *grpc.Server) {
RegisterFileSendServer(server, sp) RegisterFileSendServer(server, sp)
} }
func (sp *fsSyncTarget) DiffCopy(stream FileSend_DiffCopyServer) error { func (sp *fsSyncTarget) DiffCopy(stream FileSend_DiffCopyServer) error {
if sp.outdir != "" { if sp.outdir != "" {
return syncTargetDiffCopy(stream, sp.outdir) return syncTargetDiffCopy(stream, sp.outdir)
} }
if sp.outfile == nil {
if sp.f == nil {
return errors.New("empty outfile and outdir") return errors.New("empty outfile and outdir")
} }
defer sp.outfile.Close() opts, _ := metadata.FromIncomingContext(stream.Context()) // if no metada
return writeTargetFile(stream, sp.outfile) ta continue with empty object
md := map[string]string{}
for k, v := range opts {
if strings.HasPrefix(k, keyExporterMetaPrefix) {
md[strings.TrimPrefix(k, keyExporterMetaPrefix)] = string
s.Join(v, ",")
}
}
wc, err := sp.f(md)
if err != nil {
return err
}
if wc == nil {
return status.Errorf(codes.AlreadyExists, "target already exists"
)
}
defer wc.Close()
return writeTargetFile(stream, wc)
} }
func CopyToCaller(ctx context.Context, fs fsutil.FS, c session.Caller, progress func(int, bool)) error { func CopyToCaller(ctx context.Context, fs fsutil.FS, c session.Caller, progress func(int, bool)) error {
method := session.MethodURL(_FileSend_serviceDesc.ServiceName, "diffcopy" ) method := session.MethodURL(_FileSend_serviceDesc.ServiceName, "diffcopy" )
if !c.Supports(method) { if !c.Supports(method) {
return errors.Errorf("method %s not supported by the client", met hod) return errors.Errorf("method %s not supported by the client", met hod)
} }
client := NewFileSendClient(c.Conn()) client := NewFileSendClient(c.Conn())
cc, err := client.DiffCopy(ctx) cc, err := client.DiffCopy(ctx)
if err != nil { if err != nil {
return err return errors.WithStack(err)
} }
return sendDiffCopy(cc, fs, progress) return sendDiffCopy(cc, fs, progress)
} }
func CopyFileWriter(ctx context.Context, c session.Caller) (io.WriteCloser, erro r) { func CopyFileWriter(ctx context.Context, md map[string]string, c session.Caller) (io.WriteCloser, error) {
method := session.MethodURL(_FileSend_serviceDesc.ServiceName, "diffcopy" ) method := session.MethodURL(_FileSend_serviceDesc.ServiceName, "diffcopy" )
if !c.Supports(method) { if !c.Supports(method) {
return nil, errors.Errorf("method %s not supported by the client" , method) return nil, errors.Errorf("method %s not supported by the client" , method)
} }
client := NewFileSendClient(c.Conn()) client := NewFileSendClient(c.Conn())
opts := make(map[string][]string, len(md))
for k, v := range md {
opts[keyExporterMetaPrefix+k] = []string{v}
}
ctx = metadata.NewOutgoingContext(ctx, opts)
cc, err := client.DiffCopy(ctx) cc, err := client.DiffCopy(ctx)
if err != nil { if err != nil {
return nil, err return nil, errors.WithStack(err)
} }
return newStreamWriter(cc), nil return newStreamWriter(cc), nil
} }
 End of changes. 10 change blocks. 
15 lines changed or deleted 41 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)