Decouple redis dependency from blob descriptor cache
Ensure that clients can use the blob descriptor cache provider without needing the redis package. Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
11
registry/storage/cache/cache.go
vendored
11
registry/storage/cache/cache.go
vendored
@@ -6,7 +6,6 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/docker/distribution"
|
||||
"github.com/docker/distribution/digest"
|
||||
)
|
||||
|
||||
// BlobDescriptorCacheProvider provides repository scoped
|
||||
@@ -17,12 +16,10 @@ type BlobDescriptorCacheProvider interface {
|
||||
RepositoryScoped(repo string) (distribution.BlobDescriptorService, error)
|
||||
}
|
||||
|
||||
func validateDigest(dgst digest.Digest) error {
|
||||
return dgst.Validate()
|
||||
}
|
||||
|
||||
func validateDescriptor(desc distribution.Descriptor) error {
|
||||
if err := validateDigest(desc.Digest); err != nil {
|
||||
// ValidateDescriptor provides a helper function to ensure that caches have
|
||||
// common criteria for admitting descriptors.
|
||||
func ValidateDescriptor(desc distribution.Descriptor) error {
|
||||
if err := desc.Digest.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user