mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
94a8c8b3c0
full diff: 3bbb99cdbd...0f039a052c
- tonistiigi/fsutil#66 copy: add fast copy path for darwin
- tonistiigi/fsutil#67 Treat Unix sockets as regular files
- relates to moby/buildkit#1144 Fix socket handling
- tonistiigi/fsutil#68 fix gocrypto commit
- tonistiigi/fsutil#69 receive: use filter on receive diff
- prevents incremental transfers with userns because the metadata
on disk is always different than the one being transferred.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
51 lines
1 KiB
Go
51 lines
1 KiB
Go
package fsutil
|
|
|
|
import (
|
|
"context"
|
|
"hash"
|
|
"os"
|
|
|
|
"github.com/pkg/errors"
|
|
"github.com/tonistiigi/fsutil/types"
|
|
)
|
|
|
|
type walkerFn func(ctx context.Context, pathC chan<- *currentPath) error
|
|
|
|
func Changes(ctx context.Context, a, b walkerFn, changeFn ChangeFunc) error {
|
|
return nil
|
|
}
|
|
|
|
type HandleChangeFn func(ChangeKind, string, os.FileInfo, error) error
|
|
|
|
type ContentHasher func(*types.Stat) (hash.Hash, error)
|
|
|
|
func GetWalkerFn(root string) walkerFn {
|
|
return func(ctx context.Context, pathC chan<- *currentPath) error {
|
|
return Walk(ctx, root, nil, func(path string, f os.FileInfo, err error) error {
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
stat, ok := f.Sys().(*types.Stat)
|
|
if !ok {
|
|
return errors.Errorf("%T invalid file without stat information", f.Sys())
|
|
}
|
|
|
|
p := ¤tPath{
|
|
path: path,
|
|
stat: stat,
|
|
}
|
|
|
|
select {
|
|
case <-ctx.Done():
|
|
return ctx.Err()
|
|
case pathC <- p:
|
|
return nil
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func emptyWalker(ctx context.Context, pathC chan<- *currentPath) error {
|
|
return nil
|
|
}
|