Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

command: add sync command. #340

Closed
wants to merge 32 commits into from
Closed

command: add sync command. #340

wants to merge 32 commits into from

Conversation

ocakhasan
Copy link
Contributor

@ocakhasan ocakhasan commented Aug 12, 2021

Sync command is implemented. The use case is similar to aws-cli and s3cmd.
Usage:

s5cmd sync <src> <target>

--delete flag can be used to delete the object belongs to remote but does not belong to source.
Sync command works in this way.

  1. Get all of the source and destination objects.
  2. Determine which ones belongs to only source, which ones only destination and which ones are in common both source and destination in parallel.
  3. Only source objects are directly copied. There is no need to check if the object should be overridden.
  4. Common objects (both in source and destination) needs to be checked to see if the corresponding destination object should be overridden.
    sync command checks size and modification time default. If any of those is different, then the destination object should be overridden. However, if --size-only flag is set, then size becomes the only criteria in override operations.
  5. Only destination objects are deleted if --delete flag is set.

Resolves #3

@ocakhasan ocakhasan marked this pull request as ready for review August 18, 2021 11:34
@ocakhasan ocakhasan requested a review from a team as a code owner August 18, 2021 11:34
@ocakhasan ocakhasan requested review from igungor and sonmezonur and removed request for a team August 18, 2021 11:34
* add --size-only and --checksum flag logic to validation
* change errors in storage/hash
* moved hash errors to error package
* added usage examples to sync
* created test cases for sync with --checksum flag
@ilkinulas ilkinulas requested a review from seruman August 22, 2021 14:21
ocakhasan and others added 2 commits August 23, 2021 15:59
@kuasha420
Copy link

Amazing work!

* delete --checksum option from sync
* create an interface Strategy to compare objects
* delete tests which includes --checksum flag
* delete hash.go and hash_test.go
… and upload operations

* move transfer logic into its own package
* create a new internal folder to store all of internal packages used
* clean the unnecessary comments.
* Add comments to exported functions or structs
* add source to algorithm comment.
* delete --checksum and --size-only logic together
@igungor
Copy link
Member

igungor commented Sep 20, 2021

Current plan is to go with another approach: #347.

@igungor igungor closed this Sep 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add "sync" command
3 participants