add boilerplate for verbs data interface

This commit is contained in:
Jimmy Zelinskie 2016-08-31 15:18:01 -04:00
parent 2e5a94bc0b
commit c35413d4f6
2 changed files with 21 additions and 2 deletions

18
data/interfaces/verbs.py Normal file
View file

@ -0,0 +1,18 @@
class VerbsDataInterface(object):
"""
Interface that represents all data store interactions required by the registry's custom HTTP
verbs.
"""
@classmethod
def repository_is_public(cls, namespace_name, repo_name):
"""
Returns a boolean for whether the repository with the given name and namespace is public.
"""
raise NotImplementedError()
class PreOCIModel(VerbsDataInterface):
"""
PreOCIModel implements the data model for the registry's custom HTTP verbs using a database schema
before it was changed to support the OCI specification.
"""

View file

@ -31,8 +31,9 @@ logger = logging.getLogger(__name__)
def _open_stream(formatter, namespace, repository, tag, synthetic_image_id, image_json, repo_image,
handlers):
""" This method generates a stream of data which will be replicated and read from the queue files.
This method runs in a separate process.
"""
This method generates a stream of data which will be replicated and read from the queue files.
This method runs in a separate process.
"""
# For performance reasons, we load the full image list here, cache it, then disconnect from
# the database.