diff --git a/internal/helm/chart/dependency_manager.go b/internal/helm/chart/dependency_manager.go index e41020655..884a9c237 100644 --- a/internal/helm/chart/dependency_manager.go +++ b/internal/helm/chart/dependency_manager.go @@ -41,9 +41,10 @@ type GetChartRepositoryCallback func(url string) (*repository.ChartRepository, e // DependencyManager manages dependencies for a Helm chart. type DependencyManager struct { - // repositories contains a map of Index indexed by their - // normalized URL. It is used as a lookup table for missing - // dependencies. + // repositories contains a map of repository.ChartRepository objects + // indexed by their repository.NormalizeURL. + // It is consulted as a lookup table for missing dependencies, based on + // the (repository) URL the dependency refers to. repositories map[string]*repository.ChartRepository // getRepositoryCallback can be set to an on-demand GetChartRepositoryCallback @@ -91,6 +92,8 @@ func NewDependencyManager(opts ...DependencyManagerOption) *DependencyManager { return dm } +// Clear iterates over the repositories, calling Unload and RemoveCache on all +// items. It returns a collection of (cache removal) errors. func (dm *DependencyManager) Clear() []error { var errs []error for _, v := range dm.repositories { diff --git a/internal/helm/chart/metadata_test.go b/internal/helm/chart/metadata_test.go index d9c882f43..07449100a 100644 --- a/internal/helm/chart/metadata_test.go +++ b/internal/helm/chart/metadata_test.go @@ -1,5 +1,5 @@ /* -Copyright 2020 The Flux authors +Copyright 2021 The Flux authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/internal/helm/repository/chart_repository.go b/internal/helm/repository/chart_repository.go index 654f55be1..8cee2e026 100644 --- a/internal/helm/repository/chart_repository.go +++ b/internal/helm/repository/chart_repository.go @@ -285,7 +285,7 @@ func (r *ChartRepository) CacheIndex() (string, error) { // StrategicallyLoadIndex lazy-loads the Index from CachePath using // LoadFromCache if it does not HasIndex. -// If it not HasCacheFile, a cache attempt is made using CacheIndex +// If not HasCacheFile, a cache attempt is made using CacheIndex // before continuing to load. func (r *ChartRepository) StrategicallyLoadIndex() (err error) { if r.HasIndex() { @@ -350,7 +350,7 @@ func (r *ChartRepository) HasCacheFile() bool { } // Unload can be used to signal the Go garbage collector the Index can -// be freed from memory if the Index object is expected to +// be freed from memory if the ChartRepository object is expected to // continue to exist in the stack for some time. func (r *ChartRepository) Unload() { if r == nil {