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

GetDigest could skip API call when passed a digest #1851

Open
wholtz opened this issue Feb 15, 2023 · 1 comment
Open

GetDigest could skip API call when passed a digest #1851

wholtz opened this issue Feb 15, 2023 · 1 comment

Comments

@wholtz
Copy link

wholtz commented Feb 15, 2023

Currently, GetDigest does an API call to translate any image reference into a digest. But if the image reference contains a digest and not a tag, is there a reason why the digest should not be parsed out of the image reference, thus saving an API call?

func GetDigest(ctx context.Context, sys *types.SystemContext, ref types.ImageReference) (digest.Digest, error) {

@mtrmac
Copy link
Collaborator

mtrmac commented Feb 15, 2023

Thanks for your report.

I mean, the caller of this API is by definition specialized to do a tag resolution operation, so that caller could just … not use this?

I don’t have a strong opinion on whether the “is the reference to resolve a tag or a digest” ideally belongs inside GetDigest or inside a caller, if that condition really had to exist.


It’s more that I have a hunch that this might indicate some other design issue in the caller, trying to maintain a reference->digest mapping that doesn’t need to exist, or something like that. Or, well, a caller invoking GetDigest with a digest already known might very well be a natural outcome of some abstraction layering, where that information gets lost…, and preserving that information would be more trouble than it’s worth.

Of course, I know nothing at all about the caller, so take this just as a thing to possibly explore, something you quite likely have a firm and well-justified opinion on.

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

No branches or pull requests

2 participants