2017-12-18 23:06:04 +00:00
|
|
|
package storage
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2020-08-24 11:18:39 +00:00
|
|
|
"github.com/distribution/distribution/v3"
|
2017-12-18 23:06:04 +00:00
|
|
|
digest "github.com/opencontainers/go-digest"
|
|
|
|
)
|
|
|
|
|
|
|
|
// signedManifestHandler is a ManifestHandler that unmarshals v1 manifests but
|
|
|
|
// refuses to Put v1 manifests
|
|
|
|
type v1UnsupportedHandler struct {
|
|
|
|
innerHandler ManifestHandler
|
|
|
|
}
|
|
|
|
|
|
|
|
var _ ManifestHandler = &v1UnsupportedHandler{}
|
|
|
|
|
|
|
|
func (v *v1UnsupportedHandler) Unmarshal(ctx context.Context, dgst digest.Digest, content []byte) (distribution.Manifest, error) {
|
|
|
|
return v.innerHandler.Unmarshal(ctx, dgst, content)
|
|
|
|
}
|
2022-11-02 21:05:45 +00:00
|
|
|
|
2017-12-18 23:06:04 +00:00
|
|
|
func (v *v1UnsupportedHandler) Put(ctx context.Context, manifest distribution.Manifest, skipDependencyVerification bool) (digest.Digest, error) {
|
|
|
|
return digest.Digest(""), distribution.ErrSchemaV1Unsupported
|
|
|
|
}
|