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
Implement private.ImageDestination in all transports, improve transport helpers #1589
Commits on Jul 1, 2022
-
Beautify imagedestination.wrapped
Declare the data structure before using it, so that reading the file top-down is a bit easier. Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
-
Introduce internal/private/ImageDestinationInternalOnly
The purpose is to let a transport only implement these methods, and provide a generic fallback for the public methods. Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
-
Add internal/imagedestination.impl, and use it in storageImageDestina…
…tion Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
-
Add internal/imagedestination/stubs.NoPutBlobPartial
... so that we can have two lines instead of copy&pasted methods. Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
-
Implement private.ImageDestination in dockerImageDestination
For now, this does not change behavior; but it will allow using BlobInfoCache2 next. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
-
Use BlobInfoCache2 instead of types.BlobInfoCache in internal/types
This should not change behavior, but it changes the overhead: - Transports (like dockerImageDestination) now don't need to care about the old interface - ... it's now handled by internal/imagedestination/impl - whether the transport uses the cache or not. Overall, this should make the internal callers and internal implementations a bit simpler and faster, at the cost of moving the overhead to the compat infrastructure, and paying the cost for more external callers. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
-
Only create dirImageDestination when all checks are done
This makes it clearer that dirImageDestination is only used in a valid state. Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
-
Add a transportName parameter to docker/internal/tarfile.NewDestination
This will allow using it in error messages in the future. Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
-
Implement private.ImageDestination in non-forwarding transports
This sets up the precedent that all transports should primarily implement the private interface; that will allow us to make future changes to the private interface easier, because we can just change the public interface wrappers in a single place instead of modifying transports - especially as more stubs are added soonish. Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
-
Implement private.ImageDestination in oci/archive and openshift
This is mostly a direct forwarder to the underlying transport (for consistency, even for calls that the underlying transport implements with stubs). We also use imagedestination.FromPublic although we know that the transport implements the private interface. Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
-
Add stubs.ImplementsPutBlobPartial
This is not locally worth it, but it is a proof of the concept. Goals for similar optional transport features: - Don't use an interface type cast; require a SupportsPutBlobPartial method, so that every private transport implementor needs to make a decision whether to implment the feature. This will lead to required reviews if we add new features. - Minimize copy&pasted boilerplate methods: transports that don't implement the feature only need to add (and initialize) one No... stub. Transports that do implement the feature need to add an Implements... stub, and the actual implementation. Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
-
Add stubs.NoSignatures and stubs.AlwaysSupportsSignatures, use them i…
…n transports Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
-
Add internal/imagedestination/impl.Properties, use it to reduce boile…
…rplate It's very annoying that Go allows silent zero-initilization, and we have neither mandatory constructors nor parameter labels, i.e. a forgotten field does not cause a compile-time error. For _private_ transport implementations, relying on human review is just about acceptable. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
-
Add imagedestination.impl.Properties.SupportedManifestMIMETypes
Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
-
Add imagedestination.impl.Properties.DesiredLayerCompression
Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
-
Add Imagedestination.impl.Properties.AcceptsForeignLayerURLs
Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>