Documentation
¶
Overview ¶
Package sync copies files matching gitignore-style patterns between directories.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCloneUnsupported = errors.New("clone not supported")
ErrCloneUnsupported is returned by CloneTree / cloneFile when the platform or filesystem does not support the fast-clone path; callers fall back to io.Copy.
Functions ¶
Types ¶
type Config ¶
type Config struct {
SourceDir string
TargetDir string
// Stage is an optional profiler hook; nil means no-op.
// Call: done := cfg.Stage("name"); defer done()
Stage func(string) func()
Workers int // concurrent copy goroutines; 0 = runtime.NumCPU()
}
Config controls where FileSyncer reads from and writes to.
type FileSyncer ¶
type FileSyncer struct{}
FileSyncer is the production Syncer implementation.
func (FileSyncer) Sync ¶
func (FileSyncer) Sync(patterns []string, cfg Config) (SyncResult, error)
type SyncResult ¶
type SyncResult struct {
Files int64
}
SyncResult holds file-transfer metrics from a Sync call.
type Syncer ¶
type Syncer interface {
Sync(patterns []string, cfg Config) (SyncResult, error)
}
Syncer copies files matching patterns from SourceDir to TargetDir. Patterns follow gitignore syntax: ** matches across directories, trailing / matches a directory and all its contents, and ! prefix negates a pattern. Files absent in SourceDir are silently skipped.
Click to show internal directories.
Click to hide internal directories.