From c2cb1c916822fff990072047f47c1dc8dbfe8162 Mon Sep 17 00:00:00 2001 From: James Shubin Date: Mon, 15 May 2017 10:02:04 -0400 Subject: [PATCH] pgraph: Move GraphMetas function out of package This removes a dependency on the resources package which wasn't necessary. --- lib/main.go | 13 ++++++++++++- pgraph/pgraph.go | 11 ----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/main.go b/lib/main.go index 6a2b11cd..584320a2 100644 --- a/lib/main.go +++ b/lib/main.go @@ -453,7 +453,7 @@ func (obj *Main) Run() error { Debug: obj.Flags.Debug, }) - for _, m := range newGraph.GraphMetas() { + for _, m := range graphMetas(newGraph) { // apply the global noop parameter if requested if obj.Noop { m.Noop = obj.Noop @@ -614,3 +614,14 @@ func (obj *Main) Run() error { log.Println("Goodbye!") return reterr } + +// graphMetas returns a list of pointers to each of the resource MetaParams. +func graphMetas(g *pgraph.Graph) []*resources.MetaParams { + metas := []*resources.MetaParams{} + for _, v := range g.Vertices() { // loop through the vertices (resources) + res := v.Res // resource + meta := res.Meta() + metas = append(metas, meta) + } + return metas +} diff --git a/pgraph/pgraph.go b/pgraph/pgraph.go index 219753f7..1956c025 100644 --- a/pgraph/pgraph.go +++ b/pgraph/pgraph.go @@ -687,17 +687,6 @@ func (g *Graph) GraphSync(oldGraph *Graph) (*Graph, error) { return oldGraph, nil } -// GraphMetas returns a list of pointers to each of the resource MetaParams. -func (g *Graph) GraphMetas() []*resources.MetaParams { - metas := []*resources.MetaParams{} - for v := range g.adjacency { // loop through the vertices (resources)) - res := v.Res // resource - meta := res.Meta() - metas = append(metas, meta) - } - return metas -} - // AssociateData associates some data with the object in the graph in question. func (g *Graph) AssociateData(data *resources.Data) { // prometheus needs to be associated to this graph as well