Define a formal manifest interface and implement in the schema1 and schema2 manifests
This will allow us to pass arbitrary manifests to the model
This commit is contained in:
parent
cf5a6e1adc
commit
36c7482385
4 changed files with 94 additions and 5 deletions
41
image/docker/interfaces.py
Normal file
41
image/docker/interfaces.py
Normal file
|
@ -0,0 +1,41 @@
|
|||
from abc import ABCMeta, abstractproperty
|
||||
from six import add_metaclass
|
||||
|
||||
@add_metaclass(ABCMeta)
|
||||
class ManifestInterface(object):
|
||||
""" Defines the interface for the various manifests types supported. """
|
||||
@abstractproperty
|
||||
def digest(self):
|
||||
""" The digest of the manifest, including type prefix. """
|
||||
pass
|
||||
|
||||
@abstractproperty
|
||||
def media_type(self):
|
||||
""" The media type of the schema. """
|
||||
pass
|
||||
|
||||
@abstractproperty
|
||||
def manifest_dict(self):
|
||||
""" Returns the manifest as a dictionary ready to be serialized to JSON. """
|
||||
pass
|
||||
|
||||
@abstractproperty
|
||||
def bytes(self):
|
||||
""" Returns the bytes of the manifest. """
|
||||
pass
|
||||
|
||||
@abstractproperty
|
||||
def layers(self):
|
||||
""" Returns the layers of this manifest, from base to leaf. """
|
||||
pass
|
||||
|
||||
@abstractproperty
|
||||
def leaf_layer_v1_image_id(self):
|
||||
""" Returns the Docker V1 image ID for the leaf (top) layer, if any, or None if none. """
|
||||
pass
|
||||
|
||||
@abstractproperty
|
||||
def blob_digests(self):
|
||||
""" Returns an iterator over all the blob digests referenced by this manifest,
|
||||
from base to leaf. The blob digests are strings with prefixes.
|
||||
"""
|
Reference in a new issue