MCPcopy Index your code
hub / github.com/rclone/rclone / pairCopyOrMove

Method pairCopyOrMove

fs/sync/sync.go:487–512  ·  view source on GitHub ↗

pairCopyOrMove reads Objects on in and moves or copies them.

(ctx context.Context, in *pipe, fdst fs.Fs, fraction int, wg *sync.WaitGroup)

Source from the content-addressed store, hash-verified

485
486// pairCopyOrMove reads Objects on in and moves or copies them.
487func (s *syncCopyMove) pairCopyOrMove(ctx context.Context, in *pipe, fdst fs.Fs, fraction int, wg *sync.WaitGroup) {
488 defer wg.Done()
489 var err error
490 for {
491 pair, ok := in.GetMax(s.inCtx, fraction)
492 if !ok {
493 return
494 }
495 src := pair.Src
496 dst := pair.Dst
497 if s.DoMove {
498 if src != dst {
499 _, err = operations.MoveTransfer(ctx, fdst, dst, src.Remote(), src)
500 } else {
501 // src == dst signals delete the src
502 err = operations.DeleteFile(ctx, src)
503 }
504 } else {
505 _, err = operations.Copy(ctx, fdst, dst, src.Remote(), src)
506 }
507 s.processError(err)
508 if err != nil {
509 s.logger(ctx, operations.TransferError, src, dst, err)
510 }
511 }
512}
513
514// This starts the background checkers.
515func (s *syncCopyMove) startCheckers() {

Callers 1

startTransfersMethod · 0.95

Calls 7

processErrorMethod · 0.95
MoveTransferFunction · 0.92
DeleteFileFunction · 0.92
CopyFunction · 0.92
GetMaxMethod · 0.80
RemoteMethod · 0.65
DoneMethod · 0.45

Tested by

no test coverage detected