pairCopyOrMove reads Objects on in and moves or copies them.
(ctx context.Context, in *pipe, fdst fs.Fs, fraction int, wg *sync.WaitGroup)
| 485 | |
| 486 | // pairCopyOrMove reads Objects on in and moves or copies them. |
| 487 | func (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. |
| 515 | func (s *syncCopyMove) startCheckers() { |
no test coverage detected