gapi: Rename SwitchStream to Next

This is more concise and I think more logical. Complains welcome!
This commit is contained in:
James Shubin
2016-12-19 23:16:45 -05:00
parent 68cc09fef2
commit 6312b9225f
7 changed files with 12 additions and 12 deletions

View File

@@ -85,8 +85,8 @@ func (obj *MyGAPI) Graph() (*pgraph.Graph, error) {
return g, err return g, err
} }
// SwitchStream returns nil errors every time there could be a new graph. // Next returns nil errors every time there could be a new graph.
func (obj *MyGAPI) SwitchStream() chan error { func (obj *MyGAPI) Next() chan error {
if obj.data.NoWatch || obj.Interval <= 0 { if obj.data.NoWatch || obj.Interval <= 0 {
return nil return nil
} }

View File

@@ -78,8 +78,8 @@ func (obj *MyGAPI) Graph() (*pgraph.Graph, error) {
return g, nil return g, nil
} }
// SwitchStream returns nil errors every time there could be a new graph. // Next returns nil errors every time there could be a new graph.
func (obj *MyGAPI) SwitchStream() chan error { func (obj *MyGAPI) Next() chan error {
if obj.data.NoWatch || obj.Interval <= 0 { if obj.data.NoWatch || obj.Interval <= 0 {
return nil return nil
} }

View File

@@ -120,8 +120,8 @@ func (obj *MyGAPI) Graph() (*pgraph.Graph, error) {
return g, nil return g, nil
} }
// SwitchStream returns nil errors every time there could be a new graph. // Next returns nil errors every time there could be a new graph.
func (obj *MyGAPI) SwitchStream() chan error { func (obj *MyGAPI) Next() chan error {
if obj.data.NoWatch || obj.Interval <= 0 { if obj.data.NoWatch || obj.Interval <= 0 {
return nil return nil
} }

View File

@@ -45,6 +45,6 @@ type Data struct {
type GAPI interface { type GAPI interface {
Init(Data) error // initializes the GAPI and passes in useful data Init(Data) error // initializes the GAPI and passes in useful data
Graph() (*pgraph.Graph, error) // returns the most recent pgraph 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 Close() error // shutdown the GAPI
} }

View File

@@ -346,7 +346,7 @@ func (obj *Main) Run() error {
if err := obj.GAPI.Init(data); err != nil { if err := obj.GAPI.Init(data); err != nil {
obj.Exit(fmt.Errorf("Main: GAPI: Init failed: %v", err)) obj.Exit(fmt.Errorf("Main: GAPI: Init failed: %v", err))
} else if !obj.NoWatch { } else if !obj.NoWatch {
gapiChan = obj.GAPI.SwitchStream() // stream of graph switch events! gapiChan = obj.GAPI.Next() // stream of graph switch events!
} }
} }

View File

@@ -74,8 +74,8 @@ func (obj *GAPI) Graph() (*pgraph.Graph, error) {
return g, err return g, err
} }
// SwitchStream returns nil errors every time there could be a new graph. // Next returns nil errors every time there could be a new graph.
func (obj *GAPI) SwitchStream() chan error { func (obj *GAPI) Next() chan error {
if obj.data.NoWatch { if obj.data.NoWatch {
return nil return nil
} }

View File

@@ -74,8 +74,8 @@ func (obj *GAPI) Graph() (*pgraph.Graph, error) {
return g, err return g, err
} }
// SwitchStream returns nil errors every time there could be a new graph. // Next returns nil errors every time there could be a new graph.
func (obj *GAPI) SwitchStream() chan error { func (obj *GAPI) Next() chan error {
if obj.data.NoWatch { if obj.data.NoWatch {
return nil return nil
} }