This commit is contained in:
chrislu 2023-06-20 00:12:59 -07:00
parent 14a19170e2
commit a82c44972b
2 changed files with 7 additions and 3 deletions

View File

@ -44,9 +44,7 @@ func newClusterNodeGroups() *ClusterNodeGroups {
func (g *ClusterNodeGroups) getGroupMembers(filerGroup FilerGroupName, createIfNotFound bool) *GroupMembers { func (g *ClusterNodeGroups) getGroupMembers(filerGroup FilerGroupName, createIfNotFound bool) *GroupMembers {
members, found := g.groupMembers[filerGroup] members, found := g.groupMembers[filerGroup]
if !found && createIfNotFound { if !found && createIfNotFound {
members = &GroupMembers{ members = newGroupMembers()
members: make(map[pb.ServerAddress]*ClusterNode),
}
g.groupMembers[filerGroup] = members g.groupMembers[filerGroup] = members
} }
return members return members

View File

@ -9,6 +9,12 @@ type GroupMembers struct {
members map[pb.ServerAddress]*ClusterNode members map[pb.ServerAddress]*ClusterNode
} }
func newGroupMembers() *GroupMembers {
return &GroupMembers{
members: make(map[pb.ServerAddress]*ClusterNode),
}
}
func (m *GroupMembers) addMember(dataCenter DataCenter, rack Rack, address pb.ServerAddress, version string) *ClusterNode { func (m *GroupMembers) addMember(dataCenter DataCenter, rack Rack, address pb.ServerAddress, version string) *ClusterNode {
if existingNode, found := m.members[address]; found { if existingNode, found := m.members[address]; found {
existingNode.counter++ existingNode.counter++