You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
627 B

  1. package weed_server
  2. import (
  3. "context"
  4. "github.com/chrislusf/seaweedfs/weed/pb/master_pb"
  5. )
  6. func (ms *MasterServer) ListClusterNodes(ctx context.Context, req *master_pb.ListClusterNodesRequest) (*master_pb.ListClusterNodesResponse, error) {
  7. resp := &master_pb.ListClusterNodesResponse{}
  8. clusterNodes := ms.Cluster.ListClusterNode(req.ClientType)
  9. for _, node := range clusterNodes {
  10. resp.ClusterNodes = append(resp.ClusterNodes, &master_pb.ListClusterNodesResponse_ClusterNode{
  11. Address: string(node.Address),
  12. Version: node.Version,
  13. IsLeader: ms.Cluster.IsOneLeader(node.Address),
  14. })
  15. }
  16. return resp, nil
  17. }