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: add --include flag #600

Merged
merged 42 commits into from Aug 8, 2023

Conversation

ahmethakanbesel
Copy link
Contributor

@ahmethakanbesel ahmethakanbesel commented Jul 20, 2023

Resolves #516

Changes are made:

  • Added --include flag to the cp command
  • Added --include flag to the rm command

As sync uses cp and rm commands in the background, --include can also be used with sync.
--exclude has precedence over the --include flag.

@ahmethakanbesel ahmethakanbesel marked this pull request as ready for review July 24, 2023 13:43
@ahmethakanbesel ahmethakanbesel requested a review from a team as a code owner July 24, 2023 13:43
@ahmethakanbesel ahmethakanbesel requested review from igungor and ilkinulas and removed request for a team July 24, 2023 13:43
@igungor
Copy link
Member

igungor commented Jul 26, 2023

@ahmethakanbesel This feature deserves its own section in README with a few realistic examples. Could you write one?

  • What happens if there's a wildcard in URL and --include flag is given?
  • What happens if there're multiple --include flags given?
  • What happens if --include and --exclude given at the same time?

command/cp.go Outdated Show resolved Hide resolved
command/cp_test.go Outdated Show resolved Hide resolved
command/cp.go Outdated
@@ -777,6 +798,23 @@ func (c Copy) shouldOverride(ctx context.Context, srcurl *url.URL, dsturl *url.U
return stickyErr
}

// shouldCopyObject checks is object should be copied.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// shouldCopyObject checks is object should be copied.
// shouldCopyObject determines whether or not the object should be copied.

command/rm.go Outdated
@@ -195,6 +219,23 @@ func (d Delete) Run(ctx context.Context) error {
return multierror.Append(merrorResult, merrorObjects).ErrorOrNil()
}

// shouldDeleteObject checks is object should be deleted.
func (d Delete) shouldDeleteObject(object *storage.Object, verbose bool, prefix string) bool {
Copy link
Member

Choose a reason for hiding this comment

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

This logic is duplicated in shouldCopyObject function. Can we extract this logic to a function and re-use it in both cp and rm commands?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it's possible. f008722

denizsurmeli and others added 4 commits July 28, 2023 10:00
This PR adds a new io.WriterAt adapter for non-seekable writers. It uses an internal linked list to order the incoming chunks. The implementation is independent from the download manager of aws-sdk-go, and because of that currently it can not bound the memory usage. In order to limit the memory usage, we would have had to write a custom manager other than the aws-sdk-go's implementation, which seemed unfeasible.

The new implementation is about %25 percent faster than the older implementation for a 9.4 GB file with partSize=50MB and concurrency=20 parameters, with significantly higher memory usage, on average it uses 0.9 GB of memory and at most 2.1 GB is observed. Obviously, the memory usage and performance is dependent on the partSize-concurrency configuration and the link.

Resolves peak#245

Co-authored-by: İbrahim Güngör <igungor@gmail.com>
@tooptoop4
Copy link

can --include filter be added to ls command?

@ilkinulas
Copy link
Member

can --include filter be added to ls command?

@tooptoop4 could you please open an issue for this request?

README.md Outdated Show resolved Hide resolved
Co-authored-by: İlkin Balkanay <ilkinulas@gmail.com>
ilkinulas
ilkinulas previously approved these changes Aug 4, 2023
@sonmezonur sonmezonur merged commit 4c30eb3 into peak:master Aug 8, 2023
13 checks passed
@ahmethakanbesel ahmethakanbesel deleted the cp-rm-sync-include-flag branch August 8, 2023 07:30
@markkdev
Copy link

Hi, curious when the next release is planned to go out? We'd like to start using the --include flag

@igungor
Copy link
Member

igungor commented Aug 17, 2023

@markkdev Hey. Next release will be cut after all the issues are fixed in https://github.com/peak/s5cmd/milestone/9.

@markkdev
Copy link

@igungor Great, thanks for the response. Looking forward to it.

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.

Feature Request: Add --include flag to sync
7 participants