()
| 97 | } |
| 98 | |
| 99 | func (ctx *BuildContext) Exists() (meta *BuildMeta, ok bool, err error) { |
| 100 | key := ctx.Path() |
| 101 | meta, err = withLRUCache(key, func() (*BuildMeta, error) { |
| 102 | metadata, err := ctx.metaDB.Get(key) |
| 103 | if err != nil { |
| 104 | return nil, err |
| 105 | } |
| 106 | meta, err := decodeBuildMeta(metadata) |
| 107 | if err != nil { |
| 108 | // delete the invalid metadata |
| 109 | ctx.metaDB.Delete(key) |
| 110 | return nil, storage.ErrNotFound |
| 111 | } |
| 112 | return meta, nil |
| 113 | }) |
| 114 | if err != nil { |
| 115 | if err == storage.ErrNotFound { |
| 116 | err = nil |
| 117 | } |
| 118 | return |
| 119 | } |
| 120 | ok = true |
| 121 | return |
| 122 | } |
| 123 | |
| 124 | func (ctx *BuildContext) Context() context.Context { |
| 125 | if ctx.ctx != nil { |
no test coverage detected