func UnmarshalManifest(ctHeader string, p []byte) (Manifest, Descriptor, error) {
	var mediaType string
	if ctHeader != "" {
		var err error
		mediaType, _, err = mime.ParseMediaType(ctHeader)
		if err != nil {
			return nil, Descriptor{}, err
		}
	}
	unmarshalFunc, ok := mappings[mediaType]
	if !ok {
		unmarshalFunc, ok = mappings[""]
		if !ok {
			return nil, Descriptor{}, fmt.Errorf("unsupported manifest media type and no default available: %s", mediaType)
		}
	}
	return unmarshalFunc(p)
}
UnmarshalManifest looks up manifest unmarshal functions based on
MediaType
package distribution
import (
	"fmt"
	"mime"
	"github.com/docker/distribution/context"
	"github.com/opencontainers/go-digest"
)
type Manifest interface {
	References() []Descriptor
	Payload() (mediaType string, payload []byte, err error)
}
type ManifestBuilder interface {
	Build(ctx context.Context) (Manifest, error)
	References() []Descriptor
	AppendReference(dependency Describable) error
}
type ManifestService interface {
	Exists(ctx context.Context, dgst digest.Digest) (bool, error)
	Get(ctx context.Context, dgst digest.Digest, options ...ManifestServiceOption) (Manifest, error)
	Put(ctx context.Context, manifest Manifest, options ...ManifestServiceOption) (digest.Digest, error)
	Delete(ctx context.Context, dgst digest.Digest) error
}
type ManifestEnumerator interface {
	Enumerate(ctx context.Context, ingester func(digest.Digest) error) error
}
type Describable interface {
	Descriptor() Descriptor
}
func ManifestMediaTypes() (mediaTypes []string) {
	for t := range mappings {
		if t != "" {
			mediaTypes = append(mediaTypes, t)
		}
	}
	return
}
type UnmarshalFunc func([]byte) (Manifest, Descriptor, error)
var mappings = make(map[string]UnmarshalFunc, 0)