Documentation
¶
Overview ¶
Package sync decides sync directions and describes comparison scope.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Decision ¶
type Decision int
Decision represents a user-selectable sync action for a single file.
func AutoDecision ¶
AutoDecision returns the most sensible default decision for a diff session.
A 2-second threshold tolerates FAT32 time resolution and minor clock drift. When the files genuinely differ but the timestamps cannot disambiguate the direction — common over FTP/FTPS, where MDTM resolution is coarse and often unreliable — drift defaults to Upload rather than DecisionNone. Returning None here would silently drop the file from "sync all", which is the exact opposite of what a deploy-oriented tool should do.
type Result ¶
type Result struct {
Completed []int
Failures []Failure
// Err is context.Canceled after cancellation or the terminal connection
// failure that stopped the run; nil when every item was attempted.
Err error
}
Result reports what a run confirmed. Completed and Failures index into the items passed to Run; items after a stop are neither.
func Run ¶
func Run(ctx context.Context, conn remote.Client, root *fs.Root, items []Item, prog *progress.Tracker) Result
Run executes items in order over conn and root. It stops before the next item once ctx is canceled or the connection has failed, and after a certificate failure. Nothing is retried: a write that failed on a dead connection may have reached the server, so its failure says so. prog counts every attempted or skipped item and may be nil.
type ScopeOptions ¶
type ScopeOptions struct {
IncludeIgnored bool
}
ScopeOptions controls which recursively discovered files enter a comparison.