better naming

This commit is contained in:
decanus
2019-06-10 09:23:36 -07:00
parent 96e57c6f29
commit 7c890fc6fa
2 changed files with 9 additions and 9 deletions

View File

@@ -6,8 +6,8 @@ type State struct {
}
type SyncState interface {
Get(group GroupID, id MessageID, sender PeerID) State
Set(group GroupID, id MessageID, sender PeerID, newState State)
Remove(group GroupID, id MessageID, sender PeerID)
Get(group GroupID, id MessageID, peer PeerID) State
Set(group GroupID, id MessageID, peer PeerID, newState State)
Remove(group GroupID, id MessageID, peer PeerID)
Map(process func(GroupID, MessageID, PeerID, State) State)
}

View File

@@ -16,15 +16,15 @@ func NewSyncState() *memorySyncState {
}
}
func (s *memorySyncState) Get(group GroupID, id MessageID, sender PeerID) State {
func (s *memorySyncState) Get(group GroupID, id MessageID, peer PeerID) State {
s.Lock()
defer s.Unlock()
state, _ := s.state[group][id][sender]
state, _ := s.state[group][id][peer]
return state
}
func (s *memorySyncState) Set(group GroupID, id MessageID, sender PeerID, newState State) {
func (s *memorySyncState) Set(group GroupID, id MessageID, peer PeerID, newState State) {
s.Lock()
defer s.Unlock()
@@ -36,14 +36,14 @@ func (s *memorySyncState) Set(group GroupID, id MessageID, sender PeerID, newSta
s.state[group][id] = make(map[PeerID]State)
}
s.state[group][id][sender] = newState
s.state[group][id][peer] = newState
}
func (s *memorySyncState) Remove(group GroupID, id MessageID, sender PeerID) {
func (s *memorySyncState) Remove(group GroupID, id MessageID, peer PeerID) {
s.Lock()
defer s.Unlock()
delete(s.state[group][id], sender)
delete(s.state[group][id], peer)
}
func (s *memorySyncState) Map(process func(GroupID, MessageID, PeerID, State) State) {