Use a private attribute for the memberlist.Node

Signed-off-by: gotjosh <josue@grafana.com>
This commit is contained in:
gotjosh 2021-03-02 15:50:40 +00:00
parent f3a4f77021
commit 6341b9fe0d
No known key found for this signature in database
GPG Key ID: 731A782929412860
1 changed files with 4 additions and 4 deletions

View File

@ -616,21 +616,21 @@ func (p *Peer) Self() *memberlist.Node {
// Member represents a member in the cluster.
type Member struct {
*memberlist.Node
node *memberlist.Node
}
// Name implements cluster.ClusterMember
func (m Member) Name() string { return m.Node.Name }
func (m Member) Name() string { return m.node.Name }
// Address implements cluster.ClusterMember
func (m Member) Address() string { return m.Node.Address() }
func (m Member) Address() string { return m.node.Address() }
// Peers returns the peers in the cluster.
func (p *Peer) Peers() []ClusterMember {
peers := make([]ClusterMember, 0, len(p.mlist.Members()))
for _, member := range p.mlist.Members() {
peers = append(peers, Member{
Node: member,
node: member,
})
}
return peers