pgraph: Clean up pgraph module to get ready for clean lib status

The graph of dependencies in golang is a DAG, and as such doesn't allow
cycles. Clean up this lib so that it eventually doesn't import our
resources module or anything else which might want to import it.

This patch makes adjacency private, and adds a generalized key store to
the graph struct.
This commit is contained in:
James Shubin
2017-05-13 11:47:34 -04:00
parent 4bb553e015
commit d11854f4e8
12 changed files with 263 additions and 206 deletions

View File

@@ -56,7 +56,10 @@ func (obj *MyGAPI) Graph() (*pgraph.Graph, error) {
return nil, fmt.Errorf("libmgmt: MyGAPI is not initialized")
}
g := pgraph.NewGraph(obj.Name)
g, err := pgraph.NewGraph(obj.Name)
if err != nil {
return nil, err
}
// FIXME: these are being specified temporarily until it's the default!
metaparams := resources.DefaultMetaParams