MCPcopy Create free account
hub / github.com/celer-pkg/celer / CacheArtifacts

Method CacheArtifacts

configs/celer_update.go:246–268  ·  view source on GitHub ↗
(cacheArtifacts bool)

Source from the content-addressed store, hash-verified

244}
245
246func (c *Celer) CacheArtifacts(cacheArtifacts bool) error {
247 if err := c.readOrCreate(); err != nil {
248 return err
249 }
250
251 if c.configData.PkgCacheConfig == nil || strings.TrimSpace(c.configData.PkgCacheConfig.Dir) == "" {
252 return errors.ErrPkgCacheDirEmpty
253 }
254 if !fileio.PathExists(c.configData.PkgCacheConfig.Dir) {
255 return errors.ErrPkgCacheDirNotExist
256 }
257
258 // Update cacheArtifacts.
259 c.configData.PkgCacheConfig.CacheArtifacts = cacheArtifacts
260 if err := c.configData.PkgCacheConfig.Refresh(); err != nil {
261 return err
262 }
263 if err := c.save(); err != nil {
264 return err
265 }
266
267 return nil
268}
269
270func (c *Celer) CacheDownloads(cacheDownloads bool) error {
271 if err := c.readOrCreate(); err != nil {

Callers 1

configurePkgCacheMethod · 0.80

Calls 4

readOrCreateMethod · 0.95
saveMethod · 0.95
PathExistsFunction · 0.92
RefreshMethod · 0.80

Tested by

no test coverage detected