2020-12-23 10:30:42 +08:00
|
|
|
package dao
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var SharedNodeClusterDAO = new(NodeClusterDAO)
|
|
|
|
|
|
2021-06-27 22:00:02 +08:00
|
|
|
// NodeClusterDAO 集群相关操作
|
2020-12-23 10:30:42 +08:00
|
|
|
type NodeClusterDAO struct {
|
|
|
|
|
BaseDAO
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-27 22:00:02 +08:00
|
|
|
// FindEnabledNodeCluster 查找集群
|
2020-12-23 10:30:42 +08:00
|
|
|
func (this *NodeClusterDAO) FindEnabledNodeCluster(ctx context.Context, clusterId int64) (*pb.NodeCluster, error) {
|
|
|
|
|
clusterResp, err := this.RPC().NodeClusterRPC().FindEnabledNodeCluster(ctx, &pb.FindEnabledNodeClusterRequest{NodeClusterId: clusterId})
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
return clusterResp.NodeCluster, nil
|
|
|
|
|
}
|
2021-06-27 22:00:02 +08:00
|
|
|
|
|
|
|
|
// FindEnabledNodeClusterConfigInfo 查找集群概要信息
|
|
|
|
|
func (this *NodeClusterDAO) FindEnabledNodeClusterConfigInfo(ctx context.Context, clusterId int64) (*pb.FindEnabledNodeClusterConfigInfoResponse, error) {
|
|
|
|
|
return this.RPC().NodeClusterRPC().FindEnabledNodeClusterConfigInfo(ctx, &pb.FindEnabledNodeClusterConfigInfoRequest{NodeClusterId: clusterId})
|
|
|
|
|
}
|