优化节点配置生成速度

This commit is contained in:
刘祥超
2021-11-11 14:16:42 +08:00
parent 8afd21f2f4
commit 5b32343a2c
49 changed files with 527 additions and 198 deletions

View File

@@ -8,12 +8,12 @@ import (
"github.com/iwind/TeaGo/maps"
)
// 防火墙动作服务
// NodeClusterFirewallActionService 防火墙动作服务
type NodeClusterFirewallActionService struct {
BaseService
}
// 创建动作
// CreateNodeClusterFirewallAction 创建动作
func (this *NodeClusterFirewallActionService) CreateNodeClusterFirewallAction(ctx context.Context, req *pb.CreateNodeClusterFirewallActionRequest) (*pb.NodeClusterFirewallActionResponse, error) {
adminId, err := this.ValidateAdmin(ctx, 0)
if err != nil {
@@ -36,7 +36,7 @@ func (this *NodeClusterFirewallActionService) CreateNodeClusterFirewallAction(ct
return &pb.NodeClusterFirewallActionResponse{NodeClusterFirewallActionId: actionId}, nil
}
// 修改动作
// UpdateNodeClusterFirewallAction 修改动作
func (this *NodeClusterFirewallActionService) UpdateNodeClusterFirewallAction(ctx context.Context, req *pb.UpdateNodeClusterFirewallActionRequest) (*pb.RPCSuccess, error) {
_, err := this.ValidateAdmin(ctx, 0)
if err != nil {
@@ -59,7 +59,7 @@ func (this *NodeClusterFirewallActionService) UpdateNodeClusterFirewallAction(ct
return this.Success()
}
// 删除动作
// DeleteNodeClusterFirewallAction 删除动作
func (this *NodeClusterFirewallActionService) DeleteNodeClusterFirewallAction(ctx context.Context, req *pb.DeleteNodeClusterFirewallActionRequest) (*pb.RPCSuccess, error) {
_, err := this.ValidateAdmin(ctx, 0)
if err != nil {
@@ -74,7 +74,7 @@ func (this *NodeClusterFirewallActionService) DeleteNodeClusterFirewallAction(ct
return this.Success()
}
// 查询集群的所有动作
// FindAllEnabledNodeClusterFirewallActions 查询集群的所有动作
func (this *NodeClusterFirewallActionService) FindAllEnabledNodeClusterFirewallActions(ctx context.Context, req *pb.FindAllEnabledNodeClusterFirewallActionsRequest) (*pb.FindAllEnabledNodeClusterFirewallActionsResponse, error) {
_, err := this.ValidateAdmin(ctx, 0)
if err != nil {
@@ -82,7 +82,7 @@ func (this *NodeClusterFirewallActionService) FindAllEnabledNodeClusterFirewallA
}
var tx = this.NullTx()
actions, err := models.SharedNodeClusterFirewallActionDAO.FindAllEnabledFirewallActions(tx, req.NodeClusterId)
actions, err := models.SharedNodeClusterFirewallActionDAO.FindAllEnabledFirewallActions(tx, req.NodeClusterId, nil)
if err != nil {
return nil, err
}
@@ -100,7 +100,7 @@ func (this *NodeClusterFirewallActionService) FindAllEnabledNodeClusterFirewallA
return &pb.FindAllEnabledNodeClusterFirewallActionsResponse{NodeClusterFirewallActions: pbActions}, nil
}
// 查询单个动作
// FindEnabledNodeClusterFirewallAction 查询单个动作
func (this *NodeClusterFirewallActionService) FindEnabledNodeClusterFirewallAction(ctx context.Context, req *pb.FindEnabledNodeClusterFirewallActionRequest) (*pb.FindEnabledNodeClusterFirewallActionResponse, error) {
_, err := this.ValidateAdmin(ctx, 0)
if err != nil {
@@ -125,7 +125,7 @@ func (this *NodeClusterFirewallActionService) FindEnabledNodeClusterFirewallActi
}}, nil
}
// 计算动作数量
// CountAllEnabledNodeClusterFirewallActions 计算动作数量
func (this *NodeClusterFirewallActionService) CountAllEnabledNodeClusterFirewallActions(ctx context.Context, req *pb.CountAllEnabledNodeClusterFirewallActionsRequest) (*pb.RPCCountResponse, error) {
_, err := this.ValidateAdmin(ctx, 0)
if err != nil {