diff --git a/model.go b/model.go index e8d7888..388000d 100644 --- a/model.go +++ b/model.go @@ -9,12 +9,12 @@ type PeersState struct { Current int } -type Model struct { +type PeersModel struct { rematch.Reducer State PeersState } -func (m *Model) Current(state PeersState, peerIndex int) PeersState { +func (m *PeersModel) Current(state PeersState, peerIndex int) PeersState { // NOTE Not sure if I should just ignore invalid values or panic if peerIndex >= 0 && peerIndex < len(state.Peers) { state.Current = peerIndex @@ -22,7 +22,7 @@ func (m *Model) Current(state PeersState, peerIndex int) PeersState { return state } -func (m *Model) Update(state PeersState, peers []Peer) PeersState { +func (m *PeersModel) Update(state PeersState, peers []Peer) PeersState { // The argument is a copy so we can modify it and return it state.Peers = peers // if not current peer is set use first one diff --git a/state.go b/state.go index 523c2ca..331f6e6 100644 --- a/state.go +++ b/state.go @@ -10,7 +10,7 @@ import ( // This might need renaming, since it also contains the Client. // I need the client to make the RPC calls. type State struct { - Reducer *Model + Reducer *PeersModel Store *store.Store Client *StatusGoClient updatePeers *rematch.Action @@ -19,7 +19,7 @@ type State struct { func NewState(client *StatusGoClient) *State { // Generate the reducer from our model. - Reducer := &Model{ + Reducer := &PeersModel{ State: PeersState{ Peers: make([]Peer, 0), Current: -1, // Should mean non selected.