util/multiprovider: Implement Info#4558
Conversation
ff8aed0 to
8df0cc3
Compare
|
Fixed, thanks for spotting! |
tonistiigi
left a comment
There was a problem hiding this comment.
Should we maybe just switch the underlying map to InfoProvider? What would that break? These runtime type checks are easy to miss on future code changes.
|
Not sure if something would break. But that would require changing a bunch of |
|
@vvoland I think we should at least try that if we have codepaths that actually call into |
539094d to
e3f7093
Compare
e3f7093 to
1cbd233
Compare
vvoland
left a comment
There was a problem hiding this comment.
Looks like this also needs an Info implementation for the remote cache providers, but not all data is available there to construct the full content.Info.
Any idea on these? @tonistiigi @crazy-max
1cbd233 to
66a524b
Compare
66a524b to
075a022
Compare
util/contentutil/fetcher.go
Outdated
| return &readerAt{Reader: rc, Closer: rc, size: desc.Size}, nil | ||
| } | ||
|
|
||
| func (p *fetchedProvider) Info(ctx context.Context, dgst digest.Digest) (content.Info, error) { |
There was a problem hiding this comment.
Did you check if this was needed for anything actually (apart from places in this PR that use it in cache import where it shouldn't be needed) or can FromFetcher keep returning content.Provider. This returns wrong size so not ideal if it actually gets called.
There was a problem hiding this comment.
I did check by replacing the Info implementation with a panic and running the buildkit tests. They all passed so I think it's not actually needed.
Also, I just implemented the Info for DescriptorProviderPair instead of doing it for each cache implementation.
075a022 to
ef637f6
Compare
|
Validate failing with: |
Require base provides to implement both content.InfoReaderProvider. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
ef637f6 to
55afcdb
Compare
|
|
||
| remote.Descriptors = append(remote.Descriptors, descPair.Descriptor) | ||
| mp.Add(descPair.Descriptor.Digest, descPair.Provider) | ||
| mp.Add(descPair.Descriptor.Digest, descPair) |
There was a problem hiding this comment.
Related to #4686 :
The original provider should be passed to the multiprovider without hiding methods with the wrapped struct (DescriptorProviderPair). Or, DescriptorProviderPair should export methods multiprovider relies on ( UnlazySession and SnapshotLabels). If this PR is still needed, I can work on this PR.
There was a problem hiding this comment.
Thanks! Feel free to carry this PR :)
client.Exportin v2 will need ancontent.Infoimplementation.