aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/all.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/rosa/all.go')
-rw-r--r--internal/rosa/all.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/internal/rosa/all.go b/internal/rosa/all.go
index 4b87ed69..fefd3863 100644
--- a/internal/rosa/all.go
+++ b/internal/rosa/all.go
@@ -307,6 +307,17 @@ var (
artifactsOnce [_toolchainEnd][len(artifactsM)]sync.Once
)
+// zero zeros the value pointed to by p.
+func zero[T any](p *T) { var v T; *p = v }
+
+// DropCaches arranges for all cached [pkg.Artifact] to be freed some time after
+// it returns. Must not be used concurrently with any other function from this
+// package.
+func DropCaches() {
+ zero(&artifacts)
+ zero(&artifactsOnce)
+}
+
// GetMetadata returns [Metadata] of a [PArtifact].
func GetMetadata(p PArtifact) *Metadata { return &artifactsM[p] }