forked from TrueCloudLab/distribution
d0f5aa670b
Our context package predates the establishment of current best practices regarding context usage and it shows. It encourages bad practices such as using contexts to propagate non-request-scoped values like the application version and using string-typed keys for context values. Move the package internal to remove it from the API surface of distribution/v3@v3.0.0 so we are free to iterate on it without being constrained by compatibility. Signed-off-by: Cory Snider <csnider@mirantis.com>
28 lines
765 B
Go
28 lines
765 B
Go
package storage
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/distribution/distribution/v3"
|
|
"github.com/distribution/distribution/v3/internal/dcontext"
|
|
"github.com/distribution/distribution/v3/manifest/ocischema"
|
|
"github.com/opencontainers/go-digest"
|
|
)
|
|
|
|
// ocischemaIndexHandler is a ManifestHandler that covers the OCI Image Index.
|
|
type ocischemaIndexHandler struct {
|
|
*manifestListHandler
|
|
}
|
|
|
|
var _ ManifestHandler = &manifestListHandler{}
|
|
|
|
func (ms *ocischemaIndexHandler) Unmarshal(ctx context.Context, dgst digest.Digest, content []byte) (distribution.Manifest, error) {
|
|
dcontext.GetLogger(ms.ctx).Debug("(*ociIndexHandler).Unmarshal")
|
|
|
|
m := &ocischema.DeserializedImageIndex{}
|
|
if err := m.UnmarshalJSON(content); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return m, nil
|
|
}
|