Implement UI support for manifest lists
This commit is contained in:
parent
276d0d571d
commit
c46b11bac1
14 changed files with 338 additions and 157 deletions
|
@ -46,6 +46,12 @@ class ManifestInterface(object):
|
|||
"""
|
||||
pass
|
||||
|
||||
@abstractproperty
|
||||
def layers_compressed_size(self):
|
||||
""" Returns the total compressed size of all the layers in this manifest. Returns None if this
|
||||
cannot be computed locally.
|
||||
"""
|
||||
|
||||
@abstractproperty
|
||||
def blob_digests(self):
|
||||
""" Returns an iterator over all the blob digests referenced by this manifest,
|
||||
|
|
|
@ -251,6 +251,10 @@ class DockerSchema1Manifest(ManifestInterface):
|
|||
def manifest_dict(self):
|
||||
return self._parsed
|
||||
|
||||
@property
|
||||
def layers_compressed_size(self):
|
||||
return None
|
||||
|
||||
@property
|
||||
def digest(self):
|
||||
return digest_tools.sha256_digest(self._payload)
|
||||
|
|
|
@ -228,6 +228,10 @@ class DockerSchema2ManifestList(ManifestInterface):
|
|||
def local_blob_digests(self):
|
||||
return self.blob_digests
|
||||
|
||||
@property
|
||||
def layers_compressed_size(self):
|
||||
return None
|
||||
|
||||
@lru_cache(maxsize=1)
|
||||
def manifests(self, lookup_manifest_fn):
|
||||
""" Returns the manifests in the list. The `lookup_manifest_fn` is a function
|
||||
|
|
|
@ -169,6 +169,10 @@ class DockerSchema2Manifest(ManifestInterface):
|
|||
self._layers = list(self._generate_layers())
|
||||
return self._layers
|
||||
|
||||
@property
|
||||
def layers_compressed_size(self):
|
||||
return sum(layer.compressed_size for layer in self.layers)
|
||||
|
||||
@property
|
||||
def leaf_layer(self):
|
||||
return self.layers[-1]
|
||||
|
|
Reference in a new issue