Add new Manifest, ManifestLabel, ManifestLegacyImage and ManifestBlob tables and start writing and GCing to/from them
This change also starts passing in the manifest interface, rather than the raw data, to the model for writing. Note that this change does *not* backfill the existing rows in to the new tables; that will occur in a followup PR. The new columns in `tagmanifest` and `tagmanifestlabel` will be used to track the backfill, as it will occur in a worker.
This commit is contained in:
parent
36c7482385
commit
a46660a06f
13 changed files with 476 additions and 120 deletions
|
@ -9,7 +9,7 @@ from data.model import (config, db_transaction, InvalidImageException, TorrentIn
|
|||
from data.database import (ImageStorage, Image, ImageStoragePlacement, ImageStorageLocation,
|
||||
ImageStorageTransformation, ImageStorageSignature,
|
||||
ImageStorageSignatureKind, Repository, Namespace, TorrentInfo, ApprBlob,
|
||||
ensure_under_transaction)
|
||||
ensure_under_transaction, ManifestBlob)
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -161,6 +161,12 @@ def garbage_collect_storage(storage_id_whitelist):
|
|||
.execute())
|
||||
logger.debug('Removed %s image storage signatures', signatures_removed)
|
||||
|
||||
blob_refs_removed = (ManifestBlob
|
||||
.delete()
|
||||
.where(ManifestBlob.blob << orphaned_storage_ids)
|
||||
.execute())
|
||||
logger.debug('Removed %s blob references', blob_refs_removed)
|
||||
|
||||
storages_removed = (ImageStorage
|
||||
.delete()
|
||||
.where(ImageStorage.id << orphaned_storage_ids)
|
||||
|
|
Reference in a new issue