blobPath returns the path appropriate for storing a blob with digest.
(digest digest.Digest, isConfig bool)
| 79 | |
| 80 | // blobPath returns the path appropriate for storing a blob with digest. |
| 81 | func (b *BlobCache) blobPath(digest digest.Digest, isConfig bool) (string, error) { |
| 82 | if err := digest.Validate(); err != nil { // Make sure digest.String() does not contain any unexpected characters |
| 83 | return "", err |
| 84 | } |
| 85 | baseName := digest.String() |
| 86 | if isConfig { |
| 87 | baseName += ".config" |
| 88 | } |
| 89 | return filepath.Join(b.directory, baseName), nil |
| 90 | } |
| 91 | |
| 92 | // findBlob checks if we have a blob for info in cache (whether a config or not) |
| 93 | // and if so, returns it path and size, and whether it was stored as a config. |
no test coverage detected