| 35 | } |
| 36 | |
| 37 | func (p *PkgCacheConfig) Refresh() error { |
| 38 | if p.Dir == "" { |
| 39 | return fmt.Errorf("pkgcache dir is empty") |
| 40 | } |
| 41 | if !fileio.PathExists(p.Dir) { |
| 42 | return fmt.Errorf("pkgcache dir does not exist: %s", p.Dir) |
| 43 | } |
| 44 | |
| 45 | // Create valid artifact config and repo config. |
| 46 | p.artifactConfig = pkgcache.NewArtifactConfig(p.ctx, p.Writable) |
| 47 | p.repoConfig = pkgcache.NewRepoConfig(p.ctx, p.Writable) |
| 48 | |
| 49 | return nil |
| 50 | } |
| 51 | |
| 52 | func (p PkgCacheConfig) GetDir(dirType context.PkgCacheDirType) string { |
| 53 | switch dirType { |