MCPcopy Index your code
hub / github.com/celer-pkg/celer / CacheDownloads

Method CacheDownloads

configs/celer_update.go:270–293  ·  view source on GitHub ↗
(cacheDownloads bool)

Source from the content-addressed store, hash-verified

268}
269
270func (c *Celer) CacheDownloads(cacheDownloads bool) error {
271 if err := c.readOrCreate(); err != nil {
272 return err
273 }
274
275 if c.configData.PkgCacheConfig == nil || strings.TrimSpace(c.configData.PkgCacheConfig.Dir) == "" {
276 return errors.ErrPkgCacheDirEmpty
277 }
278 if !fileio.PathExists(c.configData.PkgCacheConfig.Dir) {
279 return errors.ErrPkgCacheDirNotExist
280 }
281
282 // Update cachedownloads.
283 c.configData.PkgCacheConfig.CacheDownloads = cacheDownloads
284 if err := c.configData.PkgCacheConfig.Refresh(); err != nil {
285 return err
286 }
287
288 if err := c.save(); err != nil {
289 return err
290 }
291
292 return nil
293}
294
295func (c *Celer) SetProxyHost(host string) error {
296 if strings.TrimSpace(host) == "" {

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