summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-04-03 00:13:33 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-04-03 00:13:33 (GMT)
commit783cf8a2b983186b371cec346ad9151eebcc5ed1 (patch)
tree6322e47351d232263da994aa3107ab566f618831 /src
parente7fd3ffaa415c1ae72b8b36b73050d343936d1d3 (diff)
remove bloat
Diffstat (limited to 'src')
-rw-r--r--src/rhctl/switch_control.go24
1 files changed, 4 insertions, 20 deletions
diff --git a/src/rhctl/switch_control.go b/src/rhctl/switch_control.go
index 09c68a3..a73d465 100644
--- a/src/rhctl/switch_control.go
+++ b/src/rhctl/switch_control.go
@@ -57,24 +57,6 @@ type State struct {
Server map[string]ServerState
}
-func (ctrl *SwitchControl) updateOverallState(update interface{}) {
- switch update.(type) {
- case SwitchState:
- // s := update.(SwitchState)
- rhdl.Printf("SwitchCTRL: got switch update updateting overall-state")
- // TODO: update ctrl.state
- case ServerState:
- s := update.(ServerState)
- rhdl.Printf("SwitchCTRL: got server update from '%s' updateting overall-state", s.Name)
- // TODO: update ctrl.state
- default:
- rhl.Printf("SwitchCTRL: got unknown state-update of type %T", update)
- return
- }
- rhdl.Printf("SwitchCTRL: overall-state is now: %+v", ctrl.state)
- return
-}
-
type CommandType uint8
const (
@@ -142,6 +124,8 @@ func (ctrl *SwitchControl) reconcile() {
// TODO: send out commands to switch, server to get missing infos
+ // TODO: change active server it fails
+
// TODO: change switch output mappings if servers change channels or fail
}
@@ -165,13 +149,13 @@ func (ctrl *SwitchControl) Run() {
case state := <-ctrl.sw.StateChanges:
rhdl.Printf("got switch state update: %+v", state)
ctrl.Updates.Pub(state, "switch:state")
- ctrl.updateOverallState(state)
+ ctrl.state.Switch = state
ctrl.reconcile()
ctrl.Updates.Pub(ctrl.state, "state")
case state := <-serverStateChanges:
rhdl.Printf("got server state update: %+v", state)
ctrl.Updates.Pub(state, "server:state")
- ctrl.updateOverallState(state)
+ ctrl.state.Server[state.Name] = state
ctrl.reconcile()
ctrl.Updates.Pub(ctrl.state, "state")
case cmd := <-ctrl.Commands: