image/manifest.go
func manifestInstanceFromBlob(ctx context.Context, sys *types.SystemContext, src types.ImageSource, manblob []byte, mt string) (genericManifest, error) {
	switch manifest.NormalizedMIMEType(mt) {
	case manifest.DockerV2Schema1MediaType, manifest.DockerV2Schema1SignedMediaType:
		return manifestSchema1FromManifest(manblob)
	case imgspecv1.MediaTypeImageManifest:
		return manifestOCI1FromManifest(src, manblob)
	case manifest.DockerV2Schema2MediaType:
		return manifestSchema2FromManifest(src, manblob)
	case manifest.DockerV2ListMediaType:
		return manifestSchema2FromManifestList(ctx, sys, src, manblob)
	default: // Note that this may not be reachable, manifest.NormalizedMIMEType has a default for unknown values.
		return nil, fmt.Errorf("Unimplemented manifest MIME type %s", mt)
	}
}
func manifestInstanceFromBlob(ctx context.Context, sys *types.SystemContext, src types.ImageSource, manblob []byte, mt string) (genericManifest, error) {
	switch manifest.NormalizedMIMEType(mt) {
	case manifest.DockerV2Schema1MediaType, manifest.DockerV2Schema1SignedMediaType:
		return manifestSchema1FromManifest(manblob)
	case imgspecv1.MediaTypeImageManifest:
		return manifestOCI1FromManifest(src, manblob)
	case manifest.DockerV2Schema2MediaType:
		return manifestSchema2FromManifest(src, manblob)
	case manifest.DockerV2ListMediaType:
		return manifestSchema2FromManifestList(ctx, sys, src, manblob)
	default: // Note that this may not be reachable, manifest.NormalizedMIMEType has a default for unknown values.
		return nil, fmt.Errorf("Unimplemented manifest MIME type %s", mt)
	}
}
func manifestInstanceFromBlob ( ctx context . Context , sys * types . SystemContext , src types . ImageSource , manblob [ ] byte , mt string ) ( genericManifest , error ) { switch manifest . NormalizedMIMEType ( mt ) { case manifest . DockerV2Schema1MediaType , manifest . DockerV2Schema1SignedMediaType : return manifestSchema1FromManifest ( manblob ) case imgspecv1 . MediaTypeImageManifest : return manifestOCI1FromManifest ( src , manblob ) case manifest . DockerV2Schema2MediaType : return manifestSchema2FromManifest ( src , manblob ) case manifest . DockerV2ListMediaType : return manifestSchema2FromManifestList ( ctx , sys , src , manblob ) default : // Note that this may not be reachable, manifest.NormalizedMIMEType has a default for unknown values. return nil , fmt . Errorf ( " " , mt ) } }
// manifestInstanceFromBlob returns a genericManifest implementation for (manblob, mt) in src.
// If manblob is a manifest list, it implicitly chooses an appropriate image from the list.
manifestInstanceFromBlob returns a genericManifest implementation for ( manblob mt ) in src . If manblob is a manifest list it implicitly chooses an appropriate image from the list .