Skip to content

Commit

Permalink
gc: Allow setting a deleted repo name's suffix (PROJQUAY-8408) (quay#…
Browse files Browse the repository at this point in the history
…3563)

Allows adding a suffix to uuid repo names to collect metrics
  • Loading branch information
kleesc authored Jan 13, 2025
1 parent a4292cc commit b674c7c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions data/model/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ def set_repository_state(repo, state):


def mark_repository_for_deletion(
namespace_name, repository_name, repository_gc_queue, available_after=0
namespace_name, repository_name, repository_gc_queue, available_after=0, deleted_suffix=None
):
"""
Marks a repository for future deletion in the background.
Expand All @@ -681,7 +681,11 @@ def mark_repository_for_deletion(
Star.delete().where(Star.repository == repo).execute()

# Change the name and state of the repository.
repo.name = str(uuid.uuid4())
deleted_name = str(uuid.uuid4())
if deleted_suffix is not None:
deleted_name = "_".join([deleted_name, str(deleted_suffix)])
repo.name = deleted_name

repo.state = RepositoryState.MARKED_FOR_DELETION
repo.save()

Expand Down

0 comments on commit b674c7c

Please sign in to comment.