// LocalMember returns the Member information for the local node
495913
func (s *Serf) LocalMember() Member {
	s.memberLock.RLock()
	defer s.memberLock.RUnlock()
	return s.members[s.config.NodeName].Member
}
1319042
func removeMember(tel string, members []string) []string {
	for i, m := range members {
		if m == tel {
			members = append(members[:i], members[i+1:]...)
			break
		}
	}
	return members
}
613134
func (c *Cluster) AddMember(member *Member) error {
	c.mu.Lock()
	defer c.mu.Unlock()

	if c.removed[member.RaftID] {
		return ErrIDRemoved
	}

	c.members[member.RaftID] = member

	c.broadcastUpdate()
	return nil
}
626293
func (s *CatIndicesService) Local(local bool) *CatIndicesService {
	s.local = &local
	return s
}
1292316
func (m *GormIdentityRepository) RemoveMember(ctx context.Context, memberOf uuid.UUID, memberID uuid.UUID) error {
	defer goa.MeasureSince([]string{"goa", "db", "identity", "RemoveMember"}, time.Now())

	membership := &Membership{
		MemberOf: memberOf,
		MemberID: memberID,
	}

	err := m.db.Delete(membership).Error
	if err != nil {
		log.Error(ctx, map[string]interface{}{
			"member_of": memberOf,
			"member_id": memberID,
			"err":       err,
		}, "unable to remove the membership")
		return errs.WithStack(err)
	}

	err = m.FlagPrivilegeCacheStaleForMembershipChange(ctx, memberID, memberOf)
	if err != nil {
		log.Error(ctx, map[string]interface{}{
			"member_of": memberOf,
			"member_id": memberID,
			"err":       err,
		}, "unable to remove the membership - error notifying privilege cache")
		return errs.WithStack(err)
	}

	log.Info(ctx, map[string]interface{}{
		"member_of": memberOf,
		"member_id": memberID,
	}, "Membership removed!")

	return nil
}
647848
func (s *IndicesGetFieldMappingService) Local(local bool) *IndicesGetFieldMappingService {
	s.local = &local
	return s
}
1250100
func (db *SnapshotDB) IsMember(c context.Context, id identity.Identity, groups []string) (bool, error) {
	// TODO(vadimsh): Optimize multi-group case.
	for _, gr := range groups {
		switch found, err := db.isMemberImpl(c, id, gr); {
		case err != nil:
			return false, err
		case found:
			return true, nil
		}
	}
	return false, nil
}
710742
func (c *Client) RemoveMember(id uint64) ([]Member, error) {
	cli, err := clientv3.New(clientv3.Config{
		Endpoints:   c.Endpoints,
		DialTimeout: 30 * time.Second,
		TLS:         c.TLS,
	})
	if err != nil {
		return nil, err
	}
	defer cli.Close()

	// Remove an existing member from the cluster
	ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
	resp, err := cli.MemberRemove(ctx, id)
	cancel()
	if err != nil {
		return nil, err
	}

	// Returns the updated list of etcd members
	ret := []Member{}
	for _, m := range resp.Members {
		ret = append(ret, Member{Name: m.Name, PeerURL: m.PeerURLs[0]})
	}

	return ret, nil
}
809148
func (c *Card) RemoveMember(memberID string) error {
	path := fmt.Sprintf("cards/%s/idMembers/%s", c.ID, memberID)
	return c.client.Delete(path, Defaults(), nil)
}
1043486
func IsMember(c context.Context, groups ...string) (bool, error) {
	if s := GetState(c); s != nil {
		return s.DB().IsMember(c, s.User().Identity, groups)
	}
	return false, ErrNotConfigured
}
1125040
func (s *CatAllocationService) Local(local bool) *CatAllocationService {
	s.local = &local
	return s
}
926724
func (n *Node) CanRemoveMember(id uint64) bool {
	members := n.cluster.Members()
	nreachable := 0 // reachable managers after removal

	for _, m := range members {
		if m.RaftID == id {
			continue
		}

		// Local node from where the remove is issued
		if m.RaftID == n.Config.ID {
			nreachable++
			continue
		}

		if n.transport.Active(m.RaftID) {
			nreachable++
		}
	}

	nquorum := (len(members)-1)/2 + 1

	return nreachable >= nquorum
}
842445
func (s *IndicesGetTemplateService) Local(local bool) *IndicesGetTemplateService {
	s.local = &local
	return s
}
711820
func (n *Node) GetMemberByNodeID(nodeID string) *membership.Member {
	members := n.cluster.Members()
	for _, member := range members {
		if member.NodeID == nodeID {
			return member
		}
	}
	return nil
}
230212
func (gs GroupsService) RemoveMember(groupID, memberID, token string) error {
	_, err := newNetworkClient(gs.config).MakeRequest(network.Request{
		Method:                "DELETE",
		Path:                  fmt.Sprintf("/Groups/%s/members/%s", groupID, memberID),
		Authorization:         network.NewTokenAuthorization(token),
		AcceptableStatusCodes: []int{http.StatusOK},
	})
	if err != nil {
		return translateError(err)
	}

	return nil
}
1077657
func (s *IndicesGetSettingsService) Local(local bool) *IndicesGetSettingsService {
	s.local = &local
	return s
}
116377
func (org *User) AddMember(uid int64) error {
	return AddOrgUser(org.ID, uid)
}