Add compressed_size to both schema formats on their layers

This commit is contained in:
Joseph Schorr 2018-08-28 17:28:27 -04:00
parent 6c5c2f1a75
commit c92294c218
4 changed files with 14 additions and 7 deletions

View file

@ -72,7 +72,8 @@ class InvalidSchema1Signature(ManifestException):
pass
class Schema1Layer(namedtuple('Schema1Layer', ['digest', 'v1_metadata', 'raw_v1_metadata'])):
class Schema1Layer(namedtuple('Schema1Layer', ['digest', 'v1_metadata', 'raw_v1_metadata',
'compressed_size'])):
"""
Represents all of the data about an individual layer in a given Manifest.
This is the union of the fsLayers (digest) and the history entries (v1_compatibility).
@ -319,7 +320,9 @@ class DockerSchema1Manifest(ManifestInterface):
extracted = Schema1V1Metadata(v1_metadata['id'], v1_metadata.get('parent'),
v1_metadata.get('created'), v1_metadata.get('comment'),
command, labels)
yield Schema1Layer(image_digest, extracted, metadata_string)
compressed_size = v1_metadata.get('Size')
yield Schema1Layer(image_digest, extracted, metadata_string, compressed_size)
@property
def _payload(self):