(_ context.Context, _ string, h v1.Hash)
| 36 | } |
| 37 | |
| 38 | func (m *diskHandler) Stat(_ context.Context, _ string, h v1.Hash) (int64, error) { |
| 39 | f, err := os.Open(m.blobHashPath(h)) |
| 40 | if errors.Is(err, os.ErrNotExist) { |
| 41 | return 0, ErrNotFound |
| 42 | } else if err != nil { |
| 43 | return 0, err |
| 44 | } |
| 45 | defer f.Close() |
| 46 | |
| 47 | got, size, err := v1.SHA256(f) |
| 48 | if err != nil { |
| 49 | return 0, err |
| 50 | } |
| 51 | if got != h { |
| 52 | return 0, fmt.Errorf("%w: blob %s has digest %s", ErrNotFound, h, got) |
| 53 | } |
| 54 | return size, nil |
| 55 | } |
| 56 | |
| 57 | func (m *diskHandler) Get(_ context.Context, _ string, h v1.Hash) (io.ReadCloser, error) { |
| 58 | return os.Open(m.blobHashPath(h)) |
nothing calls this directly
no test coverage detected