2021-11-03 06:38:45 +00:00
|
|
|
package weed_server
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (ms *MasterServer) ListClusterNodes(ctx context.Context, req *master_pb.ListClusterNodesRequest) (*master_pb.ListClusterNodesResponse, error) {
|
|
|
|
resp := &master_pb.ListClusterNodesResponse{}
|
|
|
|
|
|
|
|
clusterNodes := ms.Cluster.ListClusterNode(req.ClientType)
|
|
|
|
|
|
|
|
for _, node := range clusterNodes {
|
|
|
|
resp.ClusterNodes = append(resp.ClusterNodes, &master_pb.ListClusterNodesResponse_ClusterNode{
|
2021-11-04 07:54:38 +00:00
|
|
|
Address: string(node.Address),
|
|
|
|
Version: node.Version,
|
2021-11-06 21:23:35 +00:00
|
|
|
IsLeader: ms.Cluster.IsOneLeader(node.Address),
|
2021-11-03 06:38:45 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
return resp, nil
|
|
|
|
}
|