Back to Spacedrive

File Copy Job with Strategy Pattern

.tasks/core/FILE-001-file-copy-job.md

0.4.31004 B
Original Source

Description

A flexible FileCopyJob will be implemented to handle all copy and move operations. It uses a strategy pattern to select the optimal file transfer method (e.g., local move, cross-volume stream, remote transfer) based on the source and destination SdPath.

Implementation Notes

  • The FileCopyJob and CopyOptions will be defined in src/operations/files/copy/job.rs.
  • The CopyStrategyRouter in src/operations/files/copy/routing.rs selects the appropriate strategy.
  • Implement strategies include LocalMoveStrategy, LocalStreamCopyStrategy, and RemoteTransferStrategy in src/operations/files/copy/strategy.rs.
  • The job provides detailed, byte-level progress updates.

Acceptance Criteria

  • The job can copy files and directories locally.
  • The job correctly selects an atomic rename for same-volume moves.
  • The job can orchestrate a cross-device transfer between two peers.
  • The job correctly handles delete_after_copy for move operations.