mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
refactor
This commit is contained in:
parent
14a19170e2
commit
a82c44972b
|
@ -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
|
||||||
|
|
|
@ -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++
|
||||||
|
|
Loading…
Reference in a new issue