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:
parent
fd982a8bd5
commit
812c8099a6
12 changed files with 53 additions and 50 deletions
11
docs/storage/cache/cache.go
vendored
11
docs/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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue