mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
22 lines
627 B
Go
22 lines
627 B
Go
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{
|
|
Address: string(node.Address),
|
|
Version: node.Version,
|
|
IsLeader: ms.Cluster.IsOneLeader(node.Address),
|
|
})
|
|
}
|
|
return resp, nil
|
|
}
|