(dag *graph.DAG, objOld, objNew client.Object, action *Action)
| 79 | } |
| 80 | |
| 81 | func (r *realGraphClient) Root(dag *graph.DAG, objOld, objNew client.Object, action *Action) { |
| 82 | var root *ObjectVertex |
| 83 | // find root vertex if already exists |
| 84 | if len(dag.Vertices()) > 0 { |
| 85 | if vertex := r.FindMatchedVertex(dag, objNew); vertex != nil { |
| 86 | root, _ = vertex.(*ObjectVertex) |
| 87 | } |
| 88 | } |
| 89 | // create one if root vertex not found |
| 90 | if root == nil { |
| 91 | root = &ObjectVertex{} |
| 92 | dag.AddVertex(root) |
| 93 | } |
| 94 | root.Obj, root.OriObj, root.Action = objNew, objOld, action |
| 95 | // setup dependencies |
| 96 | for _, vertex := range dag.Vertices() { |
| 97 | if vertex != root { |
| 98 | dag.Connect(root, vertex) |
| 99 | } |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | func (r *realGraphClient) Create(dag *graph.DAG, obj client.Object, opts ...GraphOption) { |
| 104 | r.doWrite(dag, nil, obj, ActionCreatePtr(), opts...) |
nothing calls this directly
no test coverage detected