From 6312b9225f3a75a515de78f9392337bd9c44dcaa Mon Sep 17 00:00:00 2001 From: James Shubin Date: Mon, 19 Dec 2016 23:16:45 -0500 Subject: [PATCH] gapi: Rename SwitchStream to Next This is more concise and I think more logical. Complains welcome! --- examples/lib/libmgmt1.go | 4 ++-- examples/lib/libmgmt2.go | 4 ++-- examples/lib/libmgmt3.go | 4 ++-- gapi/gapi.go | 2 +- lib/main.go | 2 +- puppet/gapi.go | 4 ++-- yamlgraph/gapi.go | 4 ++-- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/lib/libmgmt1.go b/examples/lib/libmgmt1.go index 19893c17..f0320ca9 100644 --- a/examples/lib/libmgmt1.go +++ b/examples/lib/libmgmt1.go @@ -85,8 +85,8 @@ func (obj *MyGAPI) Graph() (*pgraph.Graph, error) { return g, err } -// SwitchStream returns nil errors every time there could be a new graph. -func (obj *MyGAPI) SwitchStream() chan error { +// Next returns nil errors every time there could be a new graph. +func (obj *MyGAPI) Next() chan error { if obj.data.NoWatch || obj.Interval <= 0 { return nil } diff --git a/examples/lib/libmgmt2.go b/examples/lib/libmgmt2.go index 4e16771c..c4ec2903 100644 --- a/examples/lib/libmgmt2.go +++ b/examples/lib/libmgmt2.go @@ -78,8 +78,8 @@ func (obj *MyGAPI) Graph() (*pgraph.Graph, error) { return g, nil } -// SwitchStream returns nil errors every time there could be a new graph. -func (obj *MyGAPI) SwitchStream() chan error { +// Next returns nil errors every time there could be a new graph. +func (obj *MyGAPI) Next() chan error { if obj.data.NoWatch || obj.Interval <= 0 { return nil } diff --git a/examples/lib/libmgmt3.go b/examples/lib/libmgmt3.go index 1679a8ba..3c334b58 100644 --- a/examples/lib/libmgmt3.go +++ b/examples/lib/libmgmt3.go @@ -120,8 +120,8 @@ func (obj *MyGAPI) Graph() (*pgraph.Graph, error) { return g, nil } -// SwitchStream returns nil errors every time there could be a new graph. -func (obj *MyGAPI) SwitchStream() chan error { +// Next returns nil errors every time there could be a new graph. +func (obj *MyGAPI) Next() chan error { if obj.data.NoWatch || obj.Interval <= 0 { return nil } diff --git a/gapi/gapi.go b/gapi/gapi.go index 96a7e22f..d1fbd8fe 100644 --- a/gapi/gapi.go +++ b/gapi/gapi.go @@ -45,6 +45,6 @@ type Data struct { type GAPI interface { Init(Data) error // initializes the GAPI and passes in useful data Graph() (*pgraph.Graph, error) // returns the most recent pgraph - SwitchStream() chan error // returns a stream of switch events + Next() chan error // returns a stream of switch events Close() error // shutdown the GAPI } diff --git a/lib/main.go b/lib/main.go index 87c66c50..9051d856 100644 --- a/lib/main.go +++ b/lib/main.go @@ -346,7 +346,7 @@ func (obj *Main) Run() error { if err := obj.GAPI.Init(data); err != nil { obj.Exit(fmt.Errorf("Main: GAPI: Init failed: %v", err)) } else if !obj.NoWatch { - gapiChan = obj.GAPI.SwitchStream() // stream of graph switch events! + gapiChan = obj.GAPI.Next() // stream of graph switch events! } } diff --git a/puppet/gapi.go b/puppet/gapi.go index 339437aa..305756e2 100644 --- a/puppet/gapi.go +++ b/puppet/gapi.go @@ -74,8 +74,8 @@ func (obj *GAPI) Graph() (*pgraph.Graph, error) { return g, err } -// SwitchStream returns nil errors every time there could be a new graph. -func (obj *GAPI) SwitchStream() chan error { +// Next returns nil errors every time there could be a new graph. +func (obj *GAPI) Next() chan error { if obj.data.NoWatch { return nil } diff --git a/yamlgraph/gapi.go b/yamlgraph/gapi.go index 51edf253..2dced942 100644 --- a/yamlgraph/gapi.go +++ b/yamlgraph/gapi.go @@ -74,8 +74,8 @@ func (obj *GAPI) Graph() (*pgraph.Graph, error) { return g, err } -// SwitchStream returns nil errors every time there could be a new graph. -func (obj *GAPI) SwitchStream() chan error { +// Next returns nil errors every time there could be a new graph. +func (obj *GAPI) Next() chan error { if obj.data.NoWatch { return nil }