Every file is written to .vcom-part-<rand>-<name>, closed (a Close error fails the item: N-P2-6), chmod/chtimes'ed and only then renamed over the target, so a failed or cancelled overwrite keeps the old file (N-P0-4) and leaves no temp. Without atomic replace the old file is renamed aside and restored on failure. Directories are merged, never replaced (N-P0-7), and get their real mode/mtime post-order (N-P1-17); symlinks are copied as links, broken ones too (N-P1-8); mode and mtime are preserved (N-P1-9); FIFOs and devices are skipped with a warning. The copy loop goes through a ctx-aware reader with Size() and throttled byte progress. Conflict and error policies are wired in here; their tests follow in 3.3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
16 lines
602 B
Go
16 lines
602 B
Go
package transfer
|
|
|
|
import "errors"
|
|
|
|
// Prepare refuses a request with one of these (wrapped with the path).
|
|
var (
|
|
ErrSameFile = errors.New("source and target are the same file")
|
|
ErrIntoItself = errors.New("cannot copy a directory into itself")
|
|
ErrTargetNotDir = errors.New("target is not a directory")
|
|
ErrDuplicateName = errors.New("two sources have the same name")
|
|
ErrReadOnly = errors.New("read-only file system")
|
|
ErrAborted = errors.New("transfer aborted")
|
|
)
|
|
|
|
// ErrUnsupportedMove is temporary (task 3.5).
|
|
var ErrUnsupportedMove = errors.New("move is not implemented yet")
|