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/sync: update default strategy, update tests #369

Merged
merged 22 commits into from
Oct 1, 2021
Merged

Conversation

seruman
Copy link
Member

@seruman seruman commented Sep 29, 2021

Here's a summary of changes;

  • Updated default strategy (SizeAndModificationStrategy) to match awscli's default strategy (SizeAndLastModifiedSync).
    • Previously it would only sync if the source file is newer than destination.
  • Added tests for existing strategies.
  • Updated sync tests by mocking time to control remote object's upload time.
  • Added option to pass time source to gofakes3 server.

@seruman seruman marked this pull request as ready for review September 30, 2021 05:41
@seruman seruman requested a review from a team as a code owner September 30, 2021 05:41
@seruman seruman requested review from aykutfarsak and sonmezonur and removed request for a team September 30, 2021 05:41
@igungor igungor requested review from igungor and removed request for sonmezonur September 30, 2021 07:11
README.md Outdated Show resolved Hide resolved
// time: src <= dst size: src == dst should sync: no
type SizeAndModificationStrategy struct{}

func (sm *SizeAndModificationStrategy) Compare(srcObj, dstObj *storage.Object) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On my first read of the code, I think that if Compare() returns nil, it means "these files are same, no need to sync". But it works just the opposite. Maybe we could consider renaming it or working the other way around.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, I've renamed it to ShouldSync.

Copy link
Contributor

@aykutfarsak aykutfarsak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Co-authored-by: H. İbrahim Güngör <igungor@gmail.com>
seruman and others added 2 commits September 30, 2021 18:43
Co-authored-by: H. İbrahim Güngör <igungor@gmail.com>
README.md Outdated Show resolved Hide resolved
@igungor igungor merged commit dddc619 into master Oct 1, 2021
@igungor igungor deleted the update_sync branch October 1, 2021 09:13
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.

3 participants