fix: prune RPM metadata when a local file is evicted
Evicting or deleting a local RPM removed the local_files row but left its rpm_metadata behind, so generated repodata kept listing a package that no longer exists. Deletes now run a provider cleanup hook symmetric to the existing upload hook. - add PostDeleteHook and MetadataDeleter provider interfaces, plus a DeleteRPMMetadata DB method - implement AfterDelete in the RPM provider to drop the metadata row - route both local delete paths (evictLocal and the files handler) through a shared deleteLocalFile helper that removes the file then runs the hook - cover the cleanup with a dockerised test
This commit is contained in:
@@ -32,6 +32,11 @@ func (db *DB) InsertRPMMetadata(ctx context.Context, meta *provider.RPMMetadata)
|
||||
return err
|
||||
}
|
||||
|
||||
func (db *DB) DeleteRPMMetadata(ctx context.Context, repoName, filePath string) error {
|
||||
_, err := db.Pool.Exec(ctx, `DELETE FROM rpm_metadata WHERE repo_name = $1 AND file_path = $2`, repoName, filePath)
|
||||
return err
|
||||
}
|
||||
|
||||
type RPMMetadataRow struct {
|
||||
RepoName string
|
||||
FilePath string
|
||||
|
||||
Reference in New Issue
Block a user