// AddNew adds new members from given list
AddNew adds new members from given list
// AddNew adds new members from given list
func (m *RSMembers) AddNew(from RSMembers) (changes bool) {
	cm := make(map[string]struct{}, len(*m))
	lastID := 0
	for _, member := range *m {
		cm[member.Host] = struct{}{}
		if member.ID > lastID {
			lastID = member.ID
		}
	}
	for _, member := range from {
		if _, ok := cm[member.Host]; !ok {
			lastID++
			member.ID = lastID
			*m = append(*m, member)
			changes = true
		}
	}
	return changes
}
func ( m * RSMembers ) AddNew ( from RSMembers ) ( changes bool ) { cm := make ( map [ string ] struct { } , len ( * m ) ) lastID := 0 for _ , member := range * m { cm [ member . Host ] = struct { } { } if member . ID > lastID { lastID = member . ID } } for _ , member := range from { if _ , ok := cm [ member . Host ] ; ! ok { lastID ++ member . ID = lastID * m = append ( * m , member ) changes = true } } return changes }
AddNew adds new members from given list
AddNew adds new members from given list