import logging
from data.model.repository import (
find_repository_with_garbage, garbage_collect_repo, get_random_gc_policy)
from workers.gc.models_interface import GCWorkerDataInterface
logger = logging.getLogger(__name__)
class PreOCIModel(GCWorkerDataInterface):
def perform_garbage_collection(self):
repository = find_repository_with_garbage(get_random_gc_policy())
if repository is None:
logger.debug('No repository with garbage found')
return
logger.debug('Starting GC of repository #%s (%s)', repository.id, repository.name)
garbage_collect_repo(repository)
logger.debug('Finished GC of repository #%s (%s)', repository.id, repository.name)
pre_oci_model = PreOCIModel()