28 lines
958 B
Python
28 lines
958 B
Python
|
from data import model
|
||
|
from data.registry_model.interface import RegistryDataInterface
|
||
|
from data.registry_model.datatypes import Tag
|
||
|
|
||
|
|
||
|
class PreOCIModel(RegistryDataInterface):
|
||
|
"""
|
||
|
PreOCIModel implements the data model for the registry API using a database schema
|
||
|
before it was changed to support the OCI specification.
|
||
|
"""
|
||
|
|
||
|
def find_matching_tag(self, repository_ref, tag_names):
|
||
|
""" Finds an alive tag in the repository matching one of the given tag names and returns it
|
||
|
or None if none.
|
||
|
"""
|
||
|
found_tag = model.tag.find_matching_tag(repository_ref.repo_id, tag_names)
|
||
|
return Tag.for_repository_tag(found_tag)
|
||
|
|
||
|
def get_most_recent_tag(self, repository_ref):
|
||
|
""" Returns the most recently pushed alive tag in the repository, if any. If none, returns
|
||
|
None.
|
||
|
"""
|
||
|
found_tag = model.tag.get_most_recent_tag(repository_ref.repo_id)
|
||
|
return Tag.for_repository_tag(found_tag)
|
||
|
|
||
|
|
||
|
pre_oci_model = PreOCIModel()
|