From 631a78602ec7920e5f00287a0d4830eeb086b619 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Mon, 1 Jul 2019 16:38:52 -0400 Subject: [PATCH] rename Model to PeersModel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub SokoĊ‚owski --- model.go | 6 +++--- state.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) 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.