pgraph, resources: Improve Init/Close and Worker status

This should do some rough cleanups around the Init/Close of resources,
and tracking of Worker function status.
This commit is contained in:
James Shubin
2017-02-02 19:48:42 -05:00
parent bec7f1726f
commit 2da21f90f4
5 changed files with 54 additions and 34 deletions

View File

@@ -133,9 +133,8 @@ func (c *GraphConfig) NewGraphFromConfig(hostname string, world gapi.World, noop
// XXX: should we export based on a @@ prefix, or a metaparam
// like exported => true || exported => (host pattern)||(other pattern?)
if !strings.HasPrefix(res.GetName(), "@@") { // not exported resource
v := graph.GetVertexMatch(res)
v := graph.CompareMatch(res)
if v == nil { // no match found
res.Init()
v = pgraph.NewVertex(res)
graph.AddVertex(v) // call standalone in case not part of an edge
}
@@ -207,9 +206,8 @@ func (c *GraphConfig) NewGraphFromConfig(hostname string, world gapi.World, noop
if _, exists := lookup[kind]; !exists {
lookup[kind] = make(map[string]*pgraph.Vertex)
}
v := graph.GetVertexMatch(res)
v := graph.CompareMatch(res)
if v == nil { // no match found
res.Init() // initialize go channels or things won't work!!!
v = pgraph.NewVertex(res)
graph.AddVertex(v) // call standalone in case not part of an edge
}