mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
ad46348d7c
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
31 lines
722 B
Go
31 lines
722 B
Go
package filesync
|
|
|
|
import (
|
|
"time"
|
|
|
|
"google.golang.org/grpc"
|
|
|
|
"github.com/Sirupsen/logrus"
|
|
"github.com/tonistiigi/fsutil"
|
|
)
|
|
|
|
func sendDiffCopy(stream grpc.Stream, dir string, includes, excludes []string, progress progressCb) error {
|
|
return fsutil.Send(stream.Context(), stream, dir, &fsutil.WalkOpt{
|
|
ExcludePatterns: excludes,
|
|
IncludePaths: includes, // TODO: rename IncludePatterns
|
|
}, progress)
|
|
}
|
|
|
|
func recvDiffCopy(ds grpc.Stream, dest string, cu CacheUpdater) error {
|
|
st := time.Now()
|
|
defer func() {
|
|
logrus.Debugf("diffcopy took: %v", time.Since(st))
|
|
}()
|
|
var cf fsutil.ChangeFunc
|
|
if cu != nil {
|
|
cu.MarkSupported(true)
|
|
cf = cu.HandleChange
|
|
}
|
|
|
|
return fsutil.Receive(ds.Context(), ds, dest, cf)
|
|
}
|