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

feat(storage/transfermanager): add SkipIfExists option #10893

Merged
merged 6 commits into from
Sep 24, 2024

Conversation

BrennaEpp
Copy link
Contributor

No description provided.

@BrennaEpp BrennaEpp requested review from a team as code owners September 20, 2024 02:45
@product-auto-label product-auto-label bot added the api: storage Issues related to the Cloud Storage API. label Sep 20, 2024
t.Errorf("result.Err: %v", got.Err)
}

if strings.EqualFold(got.Object, "dir/objA") {
Copy link
Member

Choose a reason for hiding this comment

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

This only checks dir/objA, do you want to check the other included objects?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added.


// Now attempt to download the entire directory.
// The existing files should be skipped.
callbacks := make(chan bool)
Copy link
Member

Choose a reason for hiding this comment

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

It would help to clarify that you're checking that SkipIfExists() should not attempt downloading included files from previous directory download;

// In lex order we have:
// "dir/nested/again/obj1", -- included
// "dir/nested/objA", -- skipped
// "dir/file" -- included
// "dir/objA", -- skipped
// "dir/objB", -- skipped
// "dir/objC", -- included

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a comment here and put those objects in a variable - does that seem sufficient here?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, thank you;

case <-done:
break
case <-callbacks:
gotCallbacks++
Copy link
Member

Choose a reason for hiding this comment

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

For my learning, gotCallbacks is synchronized; so the directory download which uses a mutex could be rewritten this way. Is that correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct. I re-wrote that logic, PTAL.

storage/transfermanager/integration_test.go Show resolved Hide resolved
@BrennaEpp BrennaEpp merged commit 7daa1bd into googleapis:main Sep 24, 2024
8 checks passed
@BrennaEpp BrennaEpp deleted the tm-skipifexists branch September 24, 2024 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants