| 1 | package storage |
| 2 | |
| 3 | import ( |
| 4 | "context" |
| 5 | "errors" |
| 6 | ) |
| 7 | |
| 8 | var ErrNotFound = errors.New("not found") |
| 9 | |
| 10 | // Storage is an optional cache for GOPROXY artifacts. |
| 11 | type Storage interface { |
| 12 | Get(ctx context.Context, key string) ([]byte, string, error) // data, content-type, error |
| 13 | Put(ctx context.Context, key string, data []byte, contentType string) error |
| 14 | } |
| 15 | |
| 16 | // StatsProvider is optionally implemented by storage backends for metrics. |
| 17 | type StatsProvider interface { |
| 18 | BucketStats(ctx context.Context) (objects int64, sizeBytes int64, err error) |
| 19 | } |
| 20 | |