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:
Stephen J Day
2015-05-20 17:12:40 -07:00
parent 07ff029506
commit 87ff947038
13 changed files with 55 additions and 52 deletions

View File

@@ -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
}