summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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: