resources: Add proper edge compare method

Might as well do this cleanly in one place.
This commit is contained in:
James Shubin
2017-05-31 17:20:54 -04:00
parent 6e503cc79b
commit 14c2fd1edd
3 changed files with 19 additions and 3 deletions

View File

@@ -493,9 +493,9 @@ func (obj *Main) Run() error {
return nil
}
edgeCmpFn := func(e1, e2 pgraph.Edge) (bool, error) {
edge1 := e1.(*resources.Edge) // panic if wrong
edge2 := e2.(*resources.Edge) // panic if wrong
return edge1.Name == edge2.Name && edge1.Notify == edge2.Notify, nil // simple cmp
edge1 := e1.(*resources.Edge) // panic if wrong
edge2 := e2.(*resources.Edge) // panic if wrong
return edge1.Compare(edge2), nil
}
// on success, this updates the receiver graph...
if err := oldGraph.GraphSync(newGraph, vertexCmpFn, vertexAddFn, vertexRemoveFn, edgeCmpFn); err != nil {