2017-04-27 18:00:07 +00:00
|
|
|
package archive
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/containers/image/docker/tarfile"
|
|
|
|
"github.com/containers/image/types"
|
2017-08-05 11:40:46 +00:00
|
|
|
"github.com/sirupsen/logrus"
|
2017-04-27 18:00:07 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type archiveImageSource struct {
|
|
|
|
*tarfile.Source // Implements most of types.ImageSource
|
|
|
|
ref archiveReference
|
|
|
|
}
|
|
|
|
|
|
|
|
// newImageSource returns a types.ImageSource for the specified image reference.
|
|
|
|
// The caller must call .Close() on the returned ImageSource.
|
|
|
|
func newImageSource(ctx *types.SystemContext, ref archiveReference) types.ImageSource {
|
|
|
|
if ref.destinationRef != nil {
|
|
|
|
logrus.Warnf("docker-archive: references are not supported for sources (ignoring)")
|
|
|
|
}
|
|
|
|
src := tarfile.NewSource(ref.path)
|
|
|
|
return &archiveImageSource{
|
|
|
|
Source: src,
|
|
|
|
ref: ref,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Reference returns the reference used to set up this source, _as specified by the user_
|
|
|
|
// (not as the image itself, or its underlying storage, claims). This can be used e.g. to determine which public keys are trusted for this image.
|
|
|
|
func (s *archiveImageSource) Reference() types.ImageReference {
|
|
|
|
return s.ref
|
|
|
|
}
|
|
|
|
|
|
|
|
// Close removes resources associated with an initialized ImageSource, if any.
|
|
|
|
func (s *archiveImageSource) Close() error {
|
|
|
|
return nil
|
|
|
|
}
|
2017-11-03 17:36:13 +00:00
|
|
|
|
|
|
|
// LayerInfosForCopy() returns updated layer info that should be used when reading, in preference to values in the manifest, if specified.
|
|
|
|
func (s *archiveImageSource) LayerInfosForCopy() []types.BlobInfo {
|
|
|
|
return nil
|
|
|
|
}
|