wip
This commit is contained in:
parent
94d516a2c8
commit
9b22afd8fd
2 changed files with 44 additions and 0 deletions
44
endpoints/api/image_models_interface.py
Normal file
44
endpoints/api/image_models_interface.py
Normal file
|
@ -0,0 +1,44 @@
|
|||
from abc import ABCMeta, abstractmethod
|
||||
from collections import namedtuple
|
||||
from six import add_metaclass
|
||||
|
||||
class Image(namedtuple('Image', ['docker_image_id', 'created', 'comment', 'command', 'size',
|
||||
'uploading', 'sort_index', 'ancestors'])):
|
||||
"""
|
||||
Image represents an image.
|
||||
:type name: string
|
||||
"""
|
||||
|
||||
class ImageWithTags(namedtuple('ImageWithTags', ['image', 'tag_names'])):
|
||||
"""
|
||||
ImageWithTags represents an image, along with the tags that point to it.
|
||||
:type image: Image
|
||||
:type tag_names: list of string
|
||||
"""
|
||||
|
||||
class ImageWithHistory(namedtuple('ImageWithHistory', ['image', 'history'])):
|
||||
"""
|
||||
ImageWithHistory represents an image, along with its full history.
|
||||
:type image: Image
|
||||
:type history: list of Image
|
||||
"""
|
||||
|
||||
|
||||
@add_metaclass(ABCMeta)
|
||||
class ImageInterface(object):
|
||||
"""
|
||||
Interface that represents all data store interactions required by the image API endpoint.
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def get_repository_images(self, namespace_name, repo_name):
|
||||
"""
|
||||
Returns an iterator of all the ImageWithTag's defined in the matching repository.
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def get_repository_image(self, namespace_name, repo_name, docker_image_id):
|
||||
"""
|
||||
Returns the matching ImageWithHistory under the matching repository, if any. If none,
|
||||
returns None.
|
||||
"""
|
0
endpoints/api/image_models_pre_oci.py
Normal file
0
endpoints/api/image_models_pre_oci.py
Normal file
Reference in a new issue