Documentation ¶
Index ¶
- type Destination
- func (d *Destination) AcceptsForeignLayerURLs() bool
- func (d *Destination) AddRepoTags(tags []reference.NamedTagged)
- func (d *Destination) HasThreadSafePutBlob() bool
- func (d *Destination) IgnoresEmbeddedDockerReference() bool
- func (d *Destination) MustMatchRuntimeOS() bool
- func (d *Destination) PutBlob(ctx context.Context, stream io.Reader, inputInfo types.BlobInfo, ...) (types.BlobInfo, error)
- func (d *Destination) PutManifest(ctx context.Context, m []byte, instanceDigest *digest.Digest) error
- func (d *Destination) PutSignatures(ctx context.Context, signatures [][]byte, instanceDigest *digest.Digest) error
- func (d *Destination) SupportedManifestMIMETypes() []string
- func (d *Destination) SupportsSignatures(ctx context.Context) error
- func (d *Destination) TryReusingBlob(ctx context.Context, info types.BlobInfo, cache types.BlobInfoCache, ...) (bool, types.BlobInfo, error)
- type ManifestItem
- type Reader
- type Source
- func (s *Source) Close() error
- func (s *Source) GetBlob(ctx context.Context, info types.BlobInfo, cache types.BlobInfoCache) (io.ReadCloser, int64, error)
- func (s *Source) GetManifest(ctx context.Context, instanceDigest *digest.Digest) ([]byte, string, error)
- func (s *Source) GetSignatures(ctx context.Context, instanceDigest *digest.Digest) ([][]byte, error)
- func (s *Source) HasThreadSafeGetBlob() bool
- func (s *Source) LayerInfosForCopy(context.Context, *digest.Digest) ([]types.BlobInfo, error)
- func (s *Source) TarManifest() []ManifestItem
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Destination ¶
type Destination struct {
// contains filtered or unexported fields
}
Destination is a partial implementation of types.ImageDestination for writing to an io.Writer.
func NewDestination ¶
func NewDestination(sys *types.SystemContext, archive *Writer, ref reference.NamedTagged) *Destination
NewDestination returns a tarfile.Destination adding images to the specified Writer.
func (*Destination) AcceptsForeignLayerURLs ¶
func (d *Destination) AcceptsForeignLayerURLs() bool
AcceptsForeignLayerURLs returns false iff foreign layers in manifest should be actually uploaded to the image destination, true otherwise.
func (*Destination) AddRepoTags ¶
func (d *Destination) AddRepoTags(tags []reference.NamedTagged)
AddRepoTags adds the specified tags to the destination's repoTags.
func (*Destination) HasThreadSafePutBlob ¶
func (d *Destination) HasThreadSafePutBlob() bool
HasThreadSafePutBlob indicates whether PutBlob can be executed concurrently.
func (*Destination) IgnoresEmbeddedDockerReference ¶
func (d *Destination) IgnoresEmbeddedDockerReference() bool
IgnoresEmbeddedDockerReference returns true iff the destination does not care about Image.EmbeddedDockerReferenceConflicts(), and would prefer to receive an unmodified manifest instead of one modified for the destination. Does not make a difference if Reference().DockerReference() is nil.
func (*Destination) MustMatchRuntimeOS ¶
func (d *Destination) MustMatchRuntimeOS() bool
MustMatchRuntimeOS returns true iff the destination can store only images targeted for the current runtime architecture and OS. False otherwise.
func (*Destination) PutBlob ¶
func (d *Destination) PutBlob(ctx context.Context, stream io.Reader, inputInfo types.BlobInfo, cache types.BlobInfoCache, isConfig bool) (types.BlobInfo, error)
PutBlob writes contents of stream and returns data representing the result (with all data filled in). inputInfo.Digest can be optionally provided if known; it is not mandatory for the implementation to verify it. inputInfo.Size is the expected length of stream, if known. May update cache. WARNING: The contents of stream are being verified on the fly. Until stream.Read() returns io.EOF, the contents of the data SHOULD NOT be available to any other readers for download using the supplied digest. If stream.Read() at any time, ESPECIALLY at end of input, returns an error, PutBlob MUST 1) fail, and 2) delete any data stored so far.
func (*Destination) PutManifest ¶
func (d *Destination) PutManifest(ctx context.Context, m []byte, instanceDigest *digest.Digest) error
PutManifest writes manifest to the destination. The instanceDigest value is expected to always be nil, because this transport does not support manifest lists, so there can be no secondary manifests. FIXME? This should also receive a MIME type if known, to differentiate between schema versions. If the destination is in principle available, refuses this manifest type (e.g. it does not recognize the schema), but may accept a different manifest type, the returned error must be an ManifestTypeRejectedError.
func (*Destination) PutSignatures ¶
func (d *Destination) PutSignatures(ctx context.Context, signatures [][]byte, instanceDigest *digest.Digest) error
PutSignatures would add the given signatures to the docker tarfile (currently not supported). The instanceDigest value is expected to always be nil, because this transport does not support manifest lists, so there can be no secondary manifests. MUST be called after PutManifest (signatures reference manifest contents).
func (*Destination) SupportedManifestMIMETypes ¶
func (d *Destination) SupportedManifestMIMETypes() []string
SupportedManifestMIMETypes tells which manifest mime types the destination supports If an empty slice or nil it's returned, then any mime type can be tried to upload
func (*Destination) SupportsSignatures ¶
func (d *Destination) SupportsSignatures(ctx context.Context) error
SupportsSignatures returns an error (to be displayed to the user) if the destination certainly can't store signatures. Note: It is still possible for PutSignatures to fail if SupportsSignatures returns nil.
func (*Destination) TryReusingBlob ¶
func (d *Destination) TryReusingBlob(ctx context.Context, info types.BlobInfo, cache types.BlobInfoCache, canSubstitute bool) (bool, types.BlobInfo, error)
TryReusingBlob checks whether the transport already contains, or can efficiently reuse, a blob, and if so, applies it to the current destination (e.g. if the blob is a filesystem layer, this signifies that the changes it describes need to be applied again when composing a filesystem tree). info.Digest must not be empty. If canSubstitute, TryReusingBlob can use an equivalent equivalent of the desired blob; in that case the returned info may not match the input. If the blob has been successfully reused, returns (true, info, nil); info must contain at least a digest and size. If the transport can not reuse the requested blob, TryReusingBlob returns (false, {}, nil); it returns a non-nil error only on an unexpected failure. May use and/or update cache.
type ManifestItem ¶
type ManifestItem struct { Config string RepoTags []string Layers []string Parent imageID `json:",omitempty"` LayerSources map[digest.Digest]manifest.Schema2Descriptor `json:",omitempty"` }
ManifestItem is an element of the array stored in the top-level manifest.json file.
type Reader ¶
type Reader struct { Manifest []ManifestItem // Guaranteed to exist after the archive is created. // contains filtered or unexported fields }
Reader is a ((docker save)-formatted) tar archive that allows random access to any component.
func NewReaderFromFile ¶
func NewReaderFromFile(sys *types.SystemContext, path string) (*Reader, error)
NewReaderFromFile returns a Reader for the specified path. The caller should call .Close() on the returned archive when done.
func NewReaderFromStream ¶
NewReaderFromStream returns a Reader for the specified inputStream, which can be either compressed or uncompressed. The caller can close the inputStream immediately after NewReaderFromFile returns. The caller should call .Close() on the returned archive when done.
func (*Reader) ChooseManifestItem ¶
func (r *Reader) ChooseManifestItem(ref reference.NamedTagged, sourceIndex int) (*ManifestItem, int, error)
ChooseManifestItem selects a manifest item from r.Manifest matching (ref, sourceIndex), one or both of which should be (nil, -1). On success, it returns the manifest item and an index of the matching tag, if a tag was used for matching; the index is -1 if a tag was not used.
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
Source is a partial implementation of types.ImageSource for reading from tarPath.
func NewSource ¶
func NewSource(archive *Reader, closeArchive bool, ref reference.NamedTagged, sourceIndex int) *Source
NewSource returns a tarfile.Source for an image in the specified archive matching ref and sourceIndex (or the only image if they are (nil, -1)). The archive will be closed if closeArchive
func (*Source) GetBlob ¶
func (s *Source) GetBlob(ctx context.Context, info types.BlobInfo, cache types.BlobInfoCache) (io.ReadCloser, int64, error)
GetBlob returns a stream for the specified blob, and the blob’s size (or -1 if unknown). The Digest field in BlobInfo is guaranteed to be provided, Size may be -1 and MediaType may be optionally provided. May update BlobInfoCache, preferably after it knows for certain that a blob truly exists at a specific location.
func (*Source) GetManifest ¶
func (s *Source) GetManifest(ctx context.Context, instanceDigest *digest.Digest) ([]byte, string, error)
GetManifest returns the image's manifest along with its MIME type (which may be empty when it can't be determined but the manifest is available). It may use a remote (= slow) service. If instanceDigest is not nil, it contains a digest of the specific manifest instance to retrieve (when the primary manifest is a manifest list); this never happens if the primary manifest is not a manifest list (e.g. if the source never returns manifest lists). This source implementation does not support manifest lists, so the passed-in instanceDigest should always be nil, as the primary manifest can not be a list, so there can be no secondary instances.
func (*Source) GetSignatures ¶
func (s *Source) GetSignatures(ctx context.Context, instanceDigest *digest.Digest) ([][]byte, error)
GetSignatures returns the image's signatures. It may use a remote (= slow) service. This source implementation does not support manifest lists, so the passed-in instanceDigest should always be nil, as there can be no secondary manifests.
func (*Source) HasThreadSafeGetBlob ¶
HasThreadSafeGetBlob indicates whether GetBlob can be executed concurrently.
func (*Source) LayerInfosForCopy ¶
LayerInfosForCopy returns either nil (meaning the values in the manifest are fine), or updated values for the layer blobsums that are listed in the image's manifest. If values are returned, they should be used when using GetBlob() to read the image's layers. This source implementation does not support manifest lists, so the passed-in instanceDigest should always be nil, as the primary manifest can not be a list, so there can be no secondary manifests. The Digest field is guaranteed to be provided; Size may be -1. WARNING: The list may contain duplicates, and they are semantically relevant.
func (*Source) TarManifest ¶
func (s *Source) TarManifest() []ManifestItem
TarManifest returns contents of manifest.json
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer allows creating a (docker save)-formatted tar archive containing one or more images.