etcdserver/api/membership/member.go
func NewMember(name string, peerURLs types.URLs, clusterName string, now *time.Time) *Member {
	m := &Member{
		RaftAttributes: RaftAttributes{PeerURLs: peerURLs.StringSlice()},
		Attributes:     Attributes{Name: name},
	}

	var b []byte
	sort.Strings(m.PeerURLs)
	for _, p := range m.PeerURLs {
		b = append(b, []byte(p)...)
	}

	b = append(b, []byte(clusterName)...)
	if now != nil {
		b = append(b, []byte(fmt.Sprintf("%d", now.Unix()))...)
	}

	hash := sha1.Sum(b)
	m.ID = types.ID(binary.BigEndian.Uint64(hash[:8]))
	return m
}
func NewMember(name string, peerURLs types.URLs, clusterName string, now *time.Time) *Member {
	m := &Member{
		RaftAttributes: RaftAttributes{PeerURLs: peerURLs.StringSlice()},
		Attributes:     Attributes{Name: name},
	}

	var b []byte
	sort.Strings(m.PeerURLs)
	for _, p := range m.PeerURLs {
		b = append(b, []byte(p)...)
	}

	b = append(b, []byte(clusterName)...)
	if now != nil {
		b = append(b, []byte(fmt.Sprintf("%d", now.Unix()))...)
	}

	hash := sha1.Sum(b)
	m.ID = types.ID(binary.BigEndian.Uint64(hash[:8]))
	return m
}
func NewMember ( name string , peerURLs types . URLs , clusterName string , now * time . Time ) * Member { m := & Member { RaftAttributes : RaftAttributes { PeerURLs : peerURLs . StringSlice ( ) } , Attributes : Attributes { Name : name } , } var b [ ] byte sort . Strings ( m . PeerURLs ) for _ , p := range m . PeerURLs { b = append ( b , [ ] byte ( p ) ... ) } b = append ( b , [ ] byte ( clusterName ) ... ) if now != nil { b = append ( b , [ ] byte ( fmt . Sprintf ( " " , now . Unix ( ) ) ) ... ) } hash := sha1 . Sum ( b ) m . ID = types . ID ( binary . BigEndian . Uint64 ( hash [ : 8 ] ) ) return m }
// NewMember creates a Member without an ID and generates one based on the
// cluster name, peer URLs, and time. This is used for bootstrapping/adding new member.
NewMember creates a Member without an ID and generates one based on the cluster name peer URLs and time . This is used for bootstrapping / adding new member .