| 1 |
package cacheimport |
| 2 |
|
| 3 |
import ( |
| 4 |
"time" |
| 5 |
|
| 6 |
digest "github.com/opencontainers/go-digest" |
| 7 |
) |
| 8 |
|
| 9 |
const CacheConfigMediaTypeV0 = "application/vnd.buildkit.cacheconfig.v0" |
| 10 |
|
| 11 |
type CacheConfig struct { |
| 12 |
Layers []CacheLayer `json:"layers,omitempty"` |
| 13 |
Records []CacheRecord `json:"records,omitempty"` |
| 14 |
} |
| 15 |
|
| 16 |
type CacheLayer struct { |
| 17 |
Blob digest.Digest `json:"blob,omitempty"` |
| 18 |
ParentIndex int `json:"parent,omitempty"` |
| 19 |
Annotations *LayerAnnotations `json:"annotations,omitempty"` |
| 20 |
} |
| 21 |
|
| 22 |
type LayerAnnotations struct { |
| 23 |
MediaType string `json:"mediaType,omitempty"` |
| 24 |
DiffID digest.Digest `json:"diffID,omitempty"` |
| 25 |
Size int64 `json:"size,omitempty"` |
| 26 |
CreatedAt time.Time `json:"createdAt"` |
| 27 |
} |
| 28 |
|
| 29 |
type CacheRecord struct { |
| 30 |
Results []CacheResult `json:"layers,omitempty"` |
| 31 |
ChainedResults []ChainedResult `json:"chains,omitempty"` |
| 32 |
Digest digest.Digest `json:"digest,omitempty"` |
| 33 |
Inputs [][]CacheInput `json:"inputs,omitempty"` |
| 34 |
} |
| 35 |
|
| 36 |
type CacheResult struct { |
| 37 |
LayerIndex int `json:"layer"` |
| 38 |
CreatedAt time.Time `json:"createdAt"` |
| 39 |
} |
| 40 |
|
| 41 |
type ChainedResult struct { |
| 42 |
LayerIndexes []int `json:"layers"` |
| 43 |
CreatedAt time.Time `json:"createdAt"` |
| 44 |
} |
| 45 |
|
| 46 |
type CacheInput struct { |
| 47 |
Selector string `json:"selector,omitempty"` |
| 48 |
LinkIndex int `json:"link"` |
| 49 |
} |