engine: resources: docker: Add AutoEdges between container and image

This commit is contained in:
Jonathan Gold
2019-02-07 19:05:56 -05:00
committed by James Shubin
parent bdfb1cf33e
commit 3233973748
3 changed files with 75 additions and 4 deletions

View File

@@ -239,11 +239,25 @@ type DockerImageUID struct {
func (obj *DockerImageRes) UIDs() []engine.ResUID {
x := &DockerImageUID{
BaseUID: engine.BaseUID{Name: obj.Name(), Kind: obj.Kind()},
name: obj.Name(),
image: dockerImageNameTag(obj.Name()),
}
return []engine.ResUID{x}
}
// AutoEdges returns the AutoEdge interface.
func (obj *DockerImageRes) AutoEdges() (engine.AutoEdge, error) {
return nil, nil
}
// IFF aka if and only if they are equivalent, return true. If not, false.
func (obj *DockerImageUID) IFF(uid engine.ResUID) bool {
res, ok := uid.(*DockerImageUID)
if !ok {
return false
}
return obj.image == res.image
}
// UnmarshalYAML is the custom unmarshal handler for this struct.
// It is primarily useful for setting the defaults.
func (obj *DockerImageRes) UnmarshalYAML(unmarshal func(interface{}) error) error {