1
0
mirror of https://github.com/containers/image.git synced 2025-04-18 19:44:05 +03:00

Merge pull request #2494 from TomSweeneyRedHat/dev/tsweeney/release-5.29_accel268

[release-5.29] blobinfocache: add function to delete the cache directory
This commit is contained in:
Tom Sweeney 2024-08-01 18:43:24 -04:00 committed by GitHub
commit 46c933366a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 1 deletions

View File

@ -74,3 +74,15 @@ func DefaultCache(sys *types.SystemContext) types.BlobInfoCache {
logrus.Debugf("Using SQLite blob info cache at %s", path)
return cache
}
// CleanupDefaultCache removes the blob info cache directory.
// It deletes the cache directory but it does not affect any file or memory buffer currently
// in use.
func CleanupDefaultCache(sys *types.SystemContext) error {
dir, err := blobInfoCacheDir(sys, rootless.GetRootlessEUID())
if err != nil {
// Mirror the DefaultCache behavior that does not fail in this case
return nil
}
return os.RemoveAll(dir)
}

View File

@ -8,7 +8,7 @@ const (
// VersionMinor is for functionality in a backwards-compatible manner
VersionMinor = 29
// VersionPatch is for backwards-compatible bug fixes
VersionPatch = 5
VersionPatch = 6
// VersionDev indicates development branch. Releases will be empty string.
VersionDev = "-dev"