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

copy: attempt fallback to full retrieval only when possible #2589

Merged

Conversation

giuseppe
Copy link
Member

@giuseppe giuseppe commented Oct 3, 2024

Do not attempt the fallback mechanism unless it was reported by the underlying transport.

Follow up for: containers/storage#2118

Signed-off-by: Giuseppe Scrivano <[email protected]>
@mtrmac
Copy link
Collaborator

mtrmac commented Oct 3, 2024

Cc: @Honny1

Copy link
Member

@Honny1 Honny1 left a comment

Choose a reason for hiding this comment

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

Overall, I like the changes, but I have a few curious questions that don't block this PR.


// ErrFallbackToOrdinaryLayerDownload is a custom error type returned by PutBlobPartial.
// It suggests to the caller that a fallback mechanism can be used instead of a hard failure.
type ErrFallbackToOrdinaryLayerDownload struct {
Copy link
Member

Choose a reason for hiding this comment

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

Why is this error defined here when a similar error is created in c/storage? Is it okay to have two same-defined types? Which would be used if they have different fields? I'm just curious.

Copy link
Member Author

Choose a reason for hiding this comment

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

we don't want the copy package to have a dependency on containers/storage. In this way, it is possible to build containers/image without the storage backend and avoid the vendoring cost

Copy link
Member

Choose a reason for hiding this comment

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

Thanks

Copy link
Collaborator

Choose a reason for hiding this comment

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

(Also, it’s not just the technical dependency; c/image/copy strives to contain “generic” code without hard-coding specifics of transports or image formats.

It doesn’t always succeed — we do have some special cases, and really a lot of the private API is specific to the c/storage design and constraints.)

Copy link
Member

@Honny1 Honny1 left a comment

Choose a reason for hiding this comment

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

LGTM

If @mtrmac has no objections. We can merge this PR.

internal/private/private.go Show resolved Hide resolved
storage/storage_dest.go Show resolved Hide resolved
storage/storage_dest.go Outdated Show resolved Hide resolved
storage/storage_dest.go Outdated Show resolved Hide resolved
storage/storage_dest.go Outdated Show resolved Hide resolved
internal/private/private.go Outdated Show resolved Hide resolved
internal/private/private.go Show resolved Hide resolved
copy/single.go Outdated Show resolved Hide resolved
@giuseppe giuseppe force-pushed the partial-pulls-do-not-always-retry branch from a4d7889 to 5cebcbe Compare October 7, 2024 07:58
@giuseppe
Copy link
Member Author

giuseppe commented Oct 7, 2024

@mtrmac thanks for the review. Addressed the comments and pushed a new version

Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

Thanks!

LGTM otherwise, please merge after the comment update without another review.

internal/private/private.go Outdated Show resolved Hide resolved
define a new error type so that the caller can determine whether it is
safe to ignore the error and retrieve the resource fully.

Signed-off-by: Giuseppe Scrivano <[email protected]>
@giuseppe giuseppe force-pushed the partial-pulls-do-not-always-retry branch from 5cebcbe to 3dc265d Compare October 8, 2024 10:23
@giuseppe
Copy link
Member Author

giuseppe commented Oct 8, 2024

Thanks!

LGTM otherwise, please merge after the comment update without another review.

thanks! Comments addressed

@giuseppe giuseppe merged commit c35ec00 into containers:main Oct 8, 2024
10 checks passed
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