layerStore.Put(): update digest-based indexes when creating from templates
When we're creating a layer using another layer as a template, add the new layer's uncompressed and compressed digest to the maps we use to index layers using those digests. When we forgot to do that, searching for a layer by either would still turn up the original template, so this didn't really break anything. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
This commit is contained in:
parent
861436bbe8
commit
2de654ba2c
|
|
@ -866,6 +866,14 @@ func (r *layerStore) Put(id string, parentLayer *Layer, names []string, mountLab
|
|||
return nil, -1, err
|
||||
}
|
||||
delete(layer.Flags, incompleteFlag)
|
||||
} else {
|
||||
// applyDiffWithOptions in the `diff != nil` case handles this bit for us
|
||||
if layer.CompressedDigest != "" {
|
||||
r.bycompressedsum[layer.CompressedDigest] = append(r.bycompressedsum[layer.CompressedDigest], layer.ID)
|
||||
}
|
||||
if layer.UncompressedDigest != "" {
|
||||
r.byuncompressedsum[layer.UncompressedDigest] = append(r.byuncompressedsum[layer.UncompressedDigest], layer.ID)
|
||||
}
|
||||
}
|
||||
err = r.Save()
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue