From 7e2c15b452a35732caebca337f5e375bfbe50c7e Mon Sep 17 00:00:00 2001 From: devad Date: Mon, 24 Apr 2023 16:45:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=9F=9F=E8=B5=84=E6=BA=90=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: devad --- adaptor/PCM-CORE/api/desc/core/pcm-core.api | 23 +++- adaptor/PCM-CORE/api/desc/pcm.api | 3 + .../handler/core/listdomainresourcehandler.go | 18 +++ .../PCM-CORE/api/internal/handler/routes.go | 5 + .../api/internal/logic/core/getregionlogic.go | 1 + .../logic/core/listdomainresourcelogic.go | 36 ++++++ adaptor/PCM-CORE/api/internal/types/types.go | 19 +++ adaptor/PCM-CORE/model/domainresourcemodel.go | 27 ++++ .../PCM-CORE/model/domainresourcemodel_gen.go | 121 ++++++++++++++++++ common/config/nacos.go | 105 ++++++++++++++- common/config/vo/nacos_group.go | 5 + common/config/vo/nacos_service.go | 8 ++ common/result/httpResult.go | 1 + common/tool/convert.go | 16 +++ deploy/README.md | 10 ++ go.mod | 19 +-- go.sum | 27 +--- 17 files changed, 398 insertions(+), 46 deletions(-) create mode 100644 adaptor/PCM-CORE/api/internal/handler/core/listdomainresourcehandler.go create mode 100644 adaptor/PCM-CORE/api/internal/logic/core/listdomainresourcelogic.go create mode 100755 adaptor/PCM-CORE/model/domainresourcemodel.go create mode 100755 adaptor/PCM-CORE/model/domainresourcemodel_gen.go create mode 100644 common/config/vo/nacos_group.go create mode 100644 common/config/vo/nacos_service.go create mode 100644 deploy/README.md diff --git a/adaptor/PCM-CORE/api/desc/core/pcm-core.api b/adaptor/PCM-CORE/api/desc/core/pcm-core.api index 9b7a6d7..127d00d 100644 --- a/adaptor/PCM-CORE/api/desc/core/pcm-core.api +++ b/adaptor/PCM-CORE/api/desc/core/pcm-core.api @@ -179,7 +179,7 @@ type ( strategy string `yaml:"strategy"` tasks []TaskInfo `yaml:"tasks"` } - TaskInfo{ + TaskInfo { TaskId int64 `yaml:"taskId"` serviceName string `yaml:"serviceName"` metadata interface{} `yaml:"metadata"` @@ -269,3 +269,24 @@ type ( POpsAtFp16 float32 `json:"pOpsAtFp16"` } ) + +type ( + DomainResourceResp { + TotalCount int `json:"totalCount"` + DomainResourceList []DomainResource `json:"domainResourceList"` + } + DomainResource { + Id int64 `json:"id"` // id + DomainId string `json:"domain_id"` // 资源域id + DomainName string `json:"domain_name"` // 资源域名称 + JobCount int64 `json:"job_count"` // 资源域任务数量 + DomainSource int64 `json:"domain_source"` // 资源域数据来源:0-nudt,1-鹏城 + Stack string `json:"stack"` // 技术栈 + ResourceType string `json:"resource_type"` // 资源类型 + Cpu string `json:"cpu"` // cpu + Memory string `json:"memory"` // 内存 + Disk string `json:"disk"` // 存储 + NodeCount string `json:"nodeCount"` //节点数量 +// DeleteFlag int64 `json:"delete_flag"` // 是否删除 0:未删除,1:已经删除 + } +) \ No newline at end of file diff --git a/adaptor/PCM-CORE/api/desc/pcm.api b/adaptor/PCM-CORE/api/desc/pcm.api index 5c1be89..14f5485 100644 --- a/adaptor/PCM-CORE/api/desc/pcm.api +++ b/adaptor/PCM-CORE/api/desc/pcm.api @@ -44,6 +44,9 @@ service pcm { @handler getComputingPowerHandler get /core/getComputingPower returns (cpResp) + + @handler listDomainResourceHandler + get /core/listDomainResource returns (DomainResourceResp) } //hpc二级接口 diff --git a/adaptor/PCM-CORE/api/internal/handler/core/listdomainresourcehandler.go b/adaptor/PCM-CORE/api/internal/handler/core/listdomainresourcehandler.go new file mode 100644 index 0000000..f5a9066 --- /dev/null +++ b/adaptor/PCM-CORE/api/internal/handler/core/listdomainresourcehandler.go @@ -0,0 +1,18 @@ +package core + +import ( + "net/http" + + "PCM/common/result" + + "PCM/adaptor/PCM-CORE/api/internal/logic/core" + "PCM/adaptor/PCM-CORE/api/internal/svc" +) + +func ListDomainResourceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := core.NewListDomainResourceLogic(r.Context(), svcCtx) + resp, err := l.ListDomainResource() + result.HttpResult(r, w, resp, err) + } +} diff --git a/adaptor/PCM-CORE/api/internal/handler/routes.go b/adaptor/PCM-CORE/api/internal/handler/routes.go index 0f26c1d..4402013 100644 --- a/adaptor/PCM-CORE/api/internal/handler/routes.go +++ b/adaptor/PCM-CORE/api/internal/handler/routes.go @@ -51,6 +51,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { Path: "/core/getComputingPower", Handler: core.GetComputingPowerHandler(serverCtx), }, + { + Method: http.MethodGet, + Path: "/core/listDomainResource", + Handler: core.ListDomainResourceHandler(serverCtx), + }, }, rest.WithPrefix("/pcm/v1"), ) diff --git a/adaptor/PCM-CORE/api/internal/logic/core/getregionlogic.go b/adaptor/PCM-CORE/api/internal/logic/core/getregionlogic.go index 967293a..ca524df 100644 --- a/adaptor/PCM-CORE/api/internal/logic/core/getregionlogic.go +++ b/adaptor/PCM-CORE/api/internal/logic/core/getregionlogic.go @@ -25,6 +25,7 @@ func NewGetRegionLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetRegi } func (l *GetRegionLogic) GetRegion() (resp *types.GetRegionResp, err error) { + resp = &types.GetRegionResp{} var regionSlurmArray []model.RegionSlurm regionNameDb := l.svcCtx.DbEngin.Find(®ionSlurmArray).Not("RegionName = ?", "") softStackDb := l.svcCtx.DbEngin.Find(®ionSlurmArray).Not("SoftStack = ?", "") diff --git a/adaptor/PCM-CORE/api/internal/logic/core/listdomainresourcelogic.go b/adaptor/PCM-CORE/api/internal/logic/core/listdomainresourcelogic.go new file mode 100644 index 0000000..a1e6915 --- /dev/null +++ b/adaptor/PCM-CORE/api/internal/logic/core/listdomainresourcelogic.go @@ -0,0 +1,36 @@ +package core + +import ( + "PCM/adaptor/PCM-CORE/api/internal/svc" + "PCM/adaptor/PCM-CORE/api/internal/types" + "PCM/adaptor/PCM-CORE/model" + "PCM/common/tool" + "context" + + "github.com/zeromicro/go-zero/core/logx" +) + +type ListDomainResourceLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewListDomainResourceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListDomainResourceLogic { + return &ListDomainResourceLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *ListDomainResourceLogic) ListDomainResource() (resp *types.DomainResourceResp, err error) { + + resp = &types.DomainResourceResp{} + var domainResourceModel []model.DomainResource + sqlStr := `select * from domain_resource where delete_flag=0 order by id` + l.svcCtx.DbEngin.Raw(sqlStr).Scan(&domainResourceModel) + //fmt.Print(domainResourceModel) + tool.Convert(domainResourceModel, &resp.DomainResourceList) + return resp, nil +} diff --git a/adaptor/PCM-CORE/api/internal/types/types.go b/adaptor/PCM-CORE/api/internal/types/types.go index c8b1e83..7c68eae 100644 --- a/adaptor/PCM-CORE/api/internal/types/types.go +++ b/adaptor/PCM-CORE/api/internal/types/types.go @@ -249,6 +249,25 @@ type CpResp struct { POpsAtFp16 float32 `json:"pOpsAtFp16"` } +type DomainResourceResp struct { + DomainResourceList []DomainResource `json:"domainResourceList"` +} + +type DomainResource struct { + Id int64 `json:"id"` // id + DomainId string `json:"domainId"` // 资源域id + DomainName string `json:"domainName"` // 资源域名称 + JobCount int64 `json:"jobCount"` // 资源域任务数量 + DomainSource int64 `json:"domainSource"` // 资源域数据来源:0-nudt,1-鹏城 + Stack string `json:"stack"` // 技术栈 + ResourceType string `json:"resourceType"` // 资源类型 + Cpu string `json:"cpu"` // cpu + Memory string `json:"memory"` // 内存 + Disk string `json:"disk"` // 存储 + NodeCount string `json:"nodeCount"` //节点数量 + DeleteFlag int64 `json:"deleteFlag"` // 是否删除 0:未删除,1:已经删除 +} + type Job struct { SlurmVersion string `json:"slurmVersion"` Account string `json:"account"` diff --git a/adaptor/PCM-CORE/model/domainresourcemodel.go b/adaptor/PCM-CORE/model/domainresourcemodel.go new file mode 100755 index 0000000..a766584 --- /dev/null +++ b/adaptor/PCM-CORE/model/domainresourcemodel.go @@ -0,0 +1,27 @@ +package model + +import ( + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/sqlx" +) + +var _ DomainResourceModel = (*customDomainResourceModel)(nil) + +type ( + // DomainResourceModel is an interface to be customized, add more methods here, + // and implement the added methods in customDomainResourceModel. + DomainResourceModel interface { + domainResourceModel + } + + customDomainResourceModel struct { + *defaultDomainResourceModel + } +) + +// NewDomainResourceModel returns a model for the database table. +func NewDomainResourceModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) DomainResourceModel { + return &customDomainResourceModel{ + defaultDomainResourceModel: newDomainResourceModel(conn, c, opts...), + } +} diff --git a/adaptor/PCM-CORE/model/domainresourcemodel_gen.go b/adaptor/PCM-CORE/model/domainresourcemodel_gen.go new file mode 100755 index 0000000..7d5f687 --- /dev/null +++ b/adaptor/PCM-CORE/model/domainresourcemodel_gen.go @@ -0,0 +1,121 @@ +// Code generated by goctl. DO NOT EDIT. + +package model + +import ( + "context" + "database/sql" + "fmt" + "strings" + "time" + + "github.com/zeromicro/go-zero/core/stores/builder" + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/sqlc" + "github.com/zeromicro/go-zero/core/stores/sqlx" + "github.com/zeromicro/go-zero/core/stringx" +) + +var ( + domainResourceFieldNames = builder.RawFieldNames(&DomainResource{}) + domainResourceRows = strings.Join(domainResourceFieldNames, ",") + domainResourceRowsExpectAutoSet = strings.Join(stringx.Remove(domainResourceFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",") + domainResourceRowsWithPlaceHolder = strings.Join(stringx.Remove(domainResourceFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?" + + cachePcmDomainResourceIdPrefix = "cache:pcm:domainResource:id:" +) + +type ( + domainResourceModel interface { + Insert(ctx context.Context, data *DomainResource) (sql.Result, error) + FindOne(ctx context.Context, id int64) (*DomainResource, error) + Update(ctx context.Context, data *DomainResource) error + Delete(ctx context.Context, id int64) error + } + + defaultDomainResourceModel struct { + sqlc.CachedConn + table string + } + + DomainResource struct { + Id int64 `db:"id"` // id + DomainId string `db:"domain_id"` // 资源域id + DomainName string `db:"domain_name"` // 资源域名称 + JobCount int64 `db:"job_count"` // 资源域任务数量 + DomainSource int64 `db:"domain_source"` // 资源域数据来源:0-nudt,1-鹏城 + Stack string `db:"stack"` // 技术栈 + ResourceType string `db:"resource_type"` // 资源类型 + Cpu string `db:"cpu"` // cpu + Memory string `db:"memory"` // 内存 + Disk string `db:"disk"` // 存储 + NodeCount string `db:"node_count"` // 节点数量 + CreateTime time.Time `db:"create_time"` // 数据创建时间 + UpdateTime time.Time `db:"update_time"` // 数据更新时间 + DeleteFlag int64 `db:"delete_flag"` // 是否删除 0:未删除,1:已经删除 + } +) + +func newDomainResourceModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) *defaultDomainResourceModel { + return &defaultDomainResourceModel{ + CachedConn: sqlc.NewConn(conn, c, opts...), + table: "`domain_resource`", + } +} + +func (m *defaultDomainResourceModel) Delete(ctx context.Context, id int64) error { + pcmDomainResourceIdKey := fmt.Sprintf("%s%v", cachePcmDomainResourceIdPrefix, id) + _, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("delete from %s where `id` = ?", m.table) + return conn.ExecCtx(ctx, query, id) + }, pcmDomainResourceIdKey) + return err +} + +func (m *defaultDomainResourceModel) FindOne(ctx context.Context, id int64) (*DomainResource, error) { + pcmDomainResourceIdKey := fmt.Sprintf("%s%v", cachePcmDomainResourceIdPrefix, id) + var resp DomainResource + err := m.QueryRowCtx(ctx, &resp, pcmDomainResourceIdKey, func(ctx context.Context, conn sqlx.SqlConn, v any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", domainResourceRows, m.table) + return conn.QueryRowCtx(ctx, v, query, id) + }) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultDomainResourceModel) Insert(ctx context.Context, data *DomainResource) (sql.Result, error) { + pcmDomainResourceIdKey := fmt.Sprintf("%s%v", cachePcmDomainResourceIdPrefix, data.Id) + ret, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", m.table, domainResourceRowsExpectAutoSet) + return conn.ExecCtx(ctx, query, data.DomainId, data.DomainName, data.JobCount, data.DomainSource, data.Stack, data.ResourceType, data.Cpu, data.Memory, data.Disk, data.DeleteFlag) + }, pcmDomainResourceIdKey) + return ret, err +} + +func (m *defaultDomainResourceModel) Update(ctx context.Context, data *DomainResource) error { + pcmDomainResourceIdKey := fmt.Sprintf("%s%v", cachePcmDomainResourceIdPrefix, data.Id) + _, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, domainResourceRowsWithPlaceHolder) + return conn.ExecCtx(ctx, query, data.DomainId, data.DomainName, data.JobCount, data.DomainSource, data.Stack, data.ResourceType, data.Cpu, data.Memory, data.Disk, data.DeleteFlag, data.Id) + }, pcmDomainResourceIdKey) + return err +} + +func (m *defaultDomainResourceModel) formatPrimary(primary any) string { + return fmt.Sprintf("%s%v", cachePcmDomainResourceIdPrefix, primary) +} + +func (m *defaultDomainResourceModel) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", domainResourceRows, m.table) + return conn.QueryRowCtx(ctx, v, query, primary) +} + +func (m *defaultDomainResourceModel) tableName() string { + return m.table +} diff --git a/common/config/nacos.go b/common/config/nacos.go index a60b272..d878c08 100644 --- a/common/config/nacos.go +++ b/common/config/nacos.go @@ -1,15 +1,26 @@ package config import ( + commonVo "PCM/common/config/vo" + "PCM/common/tool" + "context" + "encoding/json" "fmt" - "github.com/zeromicro/go-zero/rest" - "github.com/zeromicro/go-zero/zrpc" - "github.com/JCCE-nudt/zero-contrib/zrpc/registry/nacos" "github.com/nacos-group/nacos-sdk-go/v2/clients" + "github.com/nacos-group/nacos-sdk-go/v2/clients/nacos_client" + "github.com/nacos-group/nacos-sdk-go/v2/clients/naming_client/naming_cache" + "github.com/nacos-group/nacos-sdk-go/v2/clients/naming_client/naming_proxy" "github.com/nacos-group/nacos-sdk-go/v2/common/constant" + "github.com/nacos-group/nacos-sdk-go/v2/common/http_agent" + "github.com/nacos-group/nacos-sdk-go/v2/common/nacos_server" + "github.com/nacos-group/nacos-sdk-go/v2/common/security" "github.com/nacos-group/nacos-sdk-go/v2/vo" "github.com/zeromicro/go-zero/core/logx" + "github.com/zeromicro/go-zero/rest" + "github.com/zeromicro/go-zero/zrpc" + "net/http" + "sync" ) type ( @@ -41,9 +52,20 @@ type ( } ) +// NamingClient ... +type NamingClient struct { + nacos_client.INacosClient + ctx context.Context + cancel context.CancelFunc + serviceProxy naming_proxy.INamingProxy + serviceInfoHolder *naming_cache.ServiceInfoHolder + clientConfig constant.ClientConfig +} + func (n *NacosConfig) Discovery(c *zrpc.RpcServerConf) { sc, cc := n.buildConfig() opts := nacos.NewNacosConfig(c.Name, c.ListenOn, sc, &cc) + opts.Group = n.Group err := nacos.RegisterService(opts) if err != nil { panic(err) @@ -126,3 +148,80 @@ func (n *NacosConfig) buildConfig() ([]constant.ServerConfig, constant.ClientCon } return sc, cc } + +type NacosServer struct { + sync.RWMutex + securityLogin security.AuthClient + serverList []constant.ServerConfig + httpAgent http_agent.IHttpAgent + timeoutMs uint64 + endpoint string + lastSrvRefTime int64 + vipSrvRefInterMills int64 + contextPath string + currentIndex int32 + ServerSrcChangeSignal chan struct{} +} + +// GetAllServicesInfo Get all Services +func (n *NacosConfig) GetAllServicesInfo() (commonVo.NacosServiceList, error) { + nacosServiceList := commonVo.NacosServiceList{} + api := constant.SERVICE_BASE_PATH + "/catalog/services" + nacosServer, err := nacos_server.NewNacosServer(context.Background(), + []constant.ServerConfig{*constant.NewServerConfig(n.ServerConfigs[0].IpAddr, n.ServerConfigs[0].Port)}, + constant.ClientConfig{}, + &http_agent.HttpAgent{}, + 1000, + "") + if err != nil { + return nacosServiceList, err + } + params := map[string]string{} + params["namespaceId"] = n.ClientConfig.NamespaceId + params["groupName"] = "" + params["pageNo"] = "1" + params["pageSize"] = "10000" + result, err := nacosServer.ReqApi(api, params, http.MethodGet, constant.ClientConfig{}) + if err != nil { + logx.Errorf("Failed to get all services ,error: <%+v>, namespace : <%s> ", err, n.ClientConfig.NamespaceId) + return nacosServiceList, err + } + err1 := json.Unmarshal([]byte(result), &nacosServiceList) + if err1 != nil { + logx.Errorf("Conversion failed ,error: %+v, str: %s", err1, result) + return nacosServiceList, err + } + return nacosServiceList, err +} + +// GetAllGroupName Get all GroupName +func (n *NacosConfig) GetAllGroupName() (nacosGroupList commonVo.NacosGroupList, err error) { + nacosServiceList := commonVo.NacosServiceList{} + api := constant.SERVICE_BASE_PATH + "/catalog/services" + nacosServer, err := nacos_server.NewNacosServer(context.Background(), + []constant.ServerConfig{*constant.NewServerConfig(n.ServerConfigs[0].IpAddr, n.ServerConfigs[0].Port)}, + constant.ClientConfig{}, + &http_agent.HttpAgent{}, + 1000, + "") + if err != nil { + return nacosGroupList, err + } + params := map[string]string{} + params["namespaceId"] = "test" + params["groupName"] = "" + params["pageNo"] = "1" + params["pageSize"] = "10000" + result, err := nacosServer.ReqApi(api, params, http.MethodGet, constant.ClientConfig{}) + err1 := json.Unmarshal([]byte(result), &nacosServiceList) + if err1 != nil { + logx.Errorf("Conversion failed ,error: %+v, str: %s", err1, result) + return nacosGroupList, err1 + } + for _, v := range nacosServiceList.ServiceList { + nacosGroupList.GroupName = append(nacosGroupList.GroupName, v.GroupName) + } + nacosGroupList.GroupName = tool.RemoveDuplication_map(nacosGroupList.GroupName) + + return nacosGroupList, err +} diff --git a/common/config/vo/nacos_group.go b/common/config/vo/nacos_group.go new file mode 100644 index 0000000..cb1099c --- /dev/null +++ b/common/config/vo/nacos_group.go @@ -0,0 +1,5 @@ +package vo + +type NacosGroupList struct { + GroupName []string `json:"groupName"` +} diff --git a/common/config/vo/nacos_service.go b/common/config/vo/nacos_service.go new file mode 100644 index 0000000..405b916 --- /dev/null +++ b/common/config/vo/nacos_service.go @@ -0,0 +1,8 @@ +package vo + +import "github.com/aliyun/alibaba-cloud-sdk-go/services/mse" + +type NacosServiceList struct { + Count int `json:"count"` + ServiceList []mse.SimpleNacosAnsService `json:"serviceList"` +} diff --git a/common/result/httpResult.go b/common/result/httpResult.go index 6e811c1..7fd3dcf 100644 --- a/common/result/httpResult.go +++ b/common/result/httpResult.go @@ -31,6 +31,7 @@ func HttpResult(r *http.Request, w http.ResponseWriter, resp interface{}, err er body.Code = 200 body.Msg = "success" body.TraceID = traceIDFromContext(r.Context()) + body.Data = resp httpx.OkJson(w, body) return } else { diff --git a/common/tool/convert.go b/common/tool/convert.go index 9a434b1..743e1d1 100644 --- a/common/tool/convert.go +++ b/common/tool/convert.go @@ -101,3 +101,19 @@ func UnMarshalK8sStruct(yamlString string, taskId int64) model.Cloud { } return cloud } + +// removeDuplication_map 去重数组 +func RemoveDuplication_map(arr []string) []string { + set := make(map[string]struct{}, len(arr)) + j := 0 + for _, v := range arr { + _, ok := set[v] + if ok { + continue + } + set[v] = struct{}{} + arr[j] = v + j++ + } + return arr[:j] +} diff --git a/deploy/README.md b/deploy/README.md new file mode 100644 index 0000000..52a7357 --- /dev/null +++ b/deploy/README.md @@ -0,0 +1,10 @@ +| 服务名 | 端口号 | +| ------------------ | ------ | +| pcm-core-api | 8999 | +| pcm-ac-rpc | 2001 | +| pcm-modelarts-rpc | 2002 | +| pcm-kubenative-rpc | 2003 | +| pcm-core-rpc | 2004 | +| pcm-hanwuji-rpc | 2005 | +| pcm-octopus-rpc | 2006 | +| pcm-th-rpc | 2007 | \ No newline at end of file diff --git a/go.mod b/go.mod index bd88424..dbbc3ee 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,7 @@ go 1.18 require ( github.com/JCCE-nudt/zero-contrib/zrpc/registry/nacos v0.0.0-20230419021610-13bbc83fbc3c github.com/Masterminds/squirrel v1.5.4 + github.com/aliyun/alibaba-cloud-sdk-go v1.61.1704 github.com/bitly/go-simplejson v0.5.0 github.com/go-redis/redis/v8 v8.11.5 github.com/go-resty/resty/v2 v2.7.0 @@ -28,8 +29,6 @@ require ( ) require ( - github.com/aliyun/alibaba-cloud-sdk-go v1.61.1704 // indirect - github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20210521184019-c5ad59b459ec // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect github.com/buger/jsonparser v1.1.1 // indirect @@ -40,10 +39,9 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/emicklei/go-restful/v3 v3.9.0 // indirect - github.com/emicklei/proto v1.11.1 // indirect github.com/fatih/color v1.15.0 // indirect - github.com/fatih/structtag v1.2.0 // indirect github.com/felixge/fgprof v0.9.3 // indirect + github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-openapi/jsonpointer v0.19.5 // indirect @@ -59,11 +57,6 @@ require ( github.com/google/pprof v0.0.0-20211214055906-6f57359322fd // indirect github.com/google/uuid v1.3.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.0 // indirect - github.com/iancoleman/strcase v0.2.0 // indirect - github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/jackc/pgpassfile v1.0.0 // indirect - github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect - github.com/jackc/pgx/v5 v5.3.1 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect @@ -72,7 +65,6 @@ require ( github.com/klauspost/compress v1.15.15 // indirect github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect - github.com/logrusorgru/aurora v2.0.3+incompatible // indirect github.com/mailru/easyjson v0.7.6 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.17 // indirect @@ -89,12 +81,6 @@ require ( github.com/prometheus/procfs v0.8.0 // indirect github.com/segmentio/kafka-go v0.4.38 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect - github.com/spf13/cobra v1.7.0 // indirect - github.com/spf13/pflag v1.0.5 // indirect - github.com/withfig/autocomplete-tools/integrations/cobra v1.2.1 // indirect - github.com/zeromicro/antlr v0.0.1 // indirect - github.com/zeromicro/ddl-parser v1.0.4 // indirect - github.com/zeromicro/go-zero/tools/goctl v1.5.1 // indirect go.etcd.io/etcd/api/v3 v3.5.7 // indirect go.etcd.io/etcd/client/pkg/v3 v3.5.7 // indirect go.etcd.io/etcd/client/v3 v3.5.7 // indirect @@ -111,7 +97,6 @@ require ( go.uber.org/automaxprocs v1.5.2 // indirect go.uber.org/multierr v1.9.0 // indirect go.uber.org/zap v1.24.0 // indirect - golang.org/x/crypto v0.6.0 // indirect golang.org/x/net v0.9.0 // indirect golang.org/x/oauth2 v0.4.0 // indirect golang.org/x/sync v0.1.0 // indirect diff --git a/go.sum b/go.sum index a888454..631bd39 100644 --- a/go.sum +++ b/go.sum @@ -426,8 +426,6 @@ github.com/alicebob/miniredis/v2 v2.30.1/go.mod h1:b25qWj4fCEsBeAAR2mlb0ufImGC6u github.com/aliyun/alibaba-cloud-sdk-go v1.61.1704 h1:PpfENOj/vPfhhy9N2OFRjpue0hjM5XqAp2thFmkXXIk= github.com/aliyun/alibaba-cloud-sdk-go v1.61.1704/go.mod h1:RcDobYh8k5VP6TNybz9m++gL3ijVI5wueVr0EM10VsU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20210521184019-c5ad59b459ec h1:EEyRvzmpEUZ+I8WmD5cw/vY8EqhambkOqy5iFr0908A= -github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20210521184019-c5ad59b459ec/go.mod h1:F7bn7fEU90QkQ3tnmaTx3LTKLEDqnwWODIYppRQ5hnY= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/beanstalkd/go-beanstalk v0.2.0/go.mod h1:/G8YTyChOtpOArwLTQPY1CHB+i212+av35bkPXXj56Y= @@ -499,8 +497,6 @@ github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb github.com/emicklei/go-restful/v3 v3.8.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/emicklei/go-restful/v3 v3.9.0 h1:XwGDlfxEnQZzuopoqxwSEllNcCOM9DhhFyhFIIGKwxE= github.com/emicklei/go-restful/v3 v3.9.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= -github.com/emicklei/proto v1.11.1 h1:CBZwNVwPJvkdevxvsoCuFedF9ENiBz0saen3L9y0OTA= -github.com/emicklei/proto v1.11.1/go.mod h1:rn1FgRS/FANiZdD2djyH7TMA9jdRDcYQ9IEN9yvjX0A= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -519,8 +515,6 @@ github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQL github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= -github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= -github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= github.com/felixge/fgprof v0.9.3 h1:VvyZxILNuCiUCSXtPtYmmtGvb65nqXh2QFWc0Wpf2/g= github.com/felixge/fgprof v0.9.3/go.mod h1:RdbpDgzqYVh/T9fPELJyV7EYJuHB55UTEULNun8eiPw= github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= @@ -528,9 +522,9 @@ github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoD github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= +github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/fullstorydev/grpcurl v1.8.7/go.mod h1:pVtM4qe3CMoLaIzYS8uvTuDj2jVYmXqMUkZeijnXp/E= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= @@ -712,20 +706,14 @@ github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0= github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20210905161508-09a460cdf81d/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= -github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= -github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk= github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= -github.com/jackc/pgx/v5 v5.3.1 h1:Fcr8QJ1ZeLi5zsPZqQeUZhNhxfkkKBOgJuYkJHoBOtU= github.com/jackc/pgx/v5 v5.3.1/go.mod h1:t3JDKnCBlYIc0ewLF0Q7B8MXmoIaBOZj/ic7iHozM/8= github.com/jackc/puddle/v2 v2.2.0/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs= @@ -795,8 +783,6 @@ github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 h1:P6pPBnrTSX3DEVR4fDembhR github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0/go.mod h1:vmVJ0l/dxyfGW6FmdpVm2joNMFikkuWg0EoCKLGUMNw= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/logrusorgru/aurora v2.0.3+incompatible h1:tOpm7WcpBTn4fjmVfgpQq0EfczGlG91VSDkswnjF5A8= -github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= github.com/lyft/protoc-gen-star v0.6.0/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA= github.com/lyft/protoc-gen-star v0.6.1/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= @@ -958,8 +944,6 @@ github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTd github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/afero v1.9.2/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= -github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= -github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= @@ -986,8 +970,6 @@ github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYa github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hMwiKKqXCQ= github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= github.com/urfave/cli/v2 v2.11.0/go.mod h1:f8iq5LtQ/bLxafbdBSLPPNsgaW0l/2fYYEHhAyPlwvo= -github.com/withfig/autocomplete-tools/integrations/cobra v1.2.1 h1:+dBg5k7nuTE38VVdoroRsT0Z88fmvdYrI2EjzJst35I= -github.com/withfig/autocomplete-tools/integrations/cobra v1.2.1/go.mod h1:nmuySobZb4kFgFy6BptpXp/BBw+xFSyvVPP6auoJB4k= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= @@ -1009,17 +991,11 @@ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5t github.com/yuin/gopher-lua v0.0.0-20220504180219-658193537a64/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw= github.com/yuin/gopher-lua v1.1.0 h1:BojcDhfyDWgU2f2TOzYK/g5p2gxMrku8oupLDqlnSqE= github.com/yuin/gopher-lua v1.1.0/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw= -github.com/zeromicro/antlr v0.0.1 h1:CQpIn/dc0pUjgGQ81y98s/NGOm2Hfru2NNio2I9mQgk= -github.com/zeromicro/antlr v0.0.1/go.mod h1:nfpjEwFR6Q4xGDJMcZnCL9tEfQRgszMwu3rDz2Z+p5M= -github.com/zeromicro/ddl-parser v1.0.4 h1:fzU0ZNfV/a6T/WO8TvZZeJE9hmdt3qHvVUsW1X9SGJQ= -github.com/zeromicro/ddl-parser v1.0.4/go.mod h1:ISU/8NuPyEpl9pa17Py9TBPetMjtsiHrb9f5XGiYbo8= github.com/zeromicro/go-queue v1.1.8 h1:DSzOYh6tSr0Flw9FqnaBX2fxR0T3vgEwVNItobLwQgE= github.com/zeromicro/go-queue v1.1.8/go.mod h1:sKF0fI9cKmqY/Y9Pr2aRnt3zllnPglBJ1yl4ByOEhiw= github.com/zeromicro/go-zero v1.4.3/go.mod h1:UmDjuW7LHd9j7+nnnPBcXF0HLNmjJw6OjHPTlSp7X7Y= github.com/zeromicro/go-zero v1.5.1 h1:UibsnkENBfeRSRczZ0qZiaLA03Isj1SmPRz3n7q4R3M= github.com/zeromicro/go-zero v1.5.1/go.mod h1:bGYm4XWsGN9GhDsO2O2BngpVoWjf3Eog2a5hUOMhlXs= -github.com/zeromicro/go-zero/tools/goctl v1.5.1 h1:3KNxB/I/Zl9obYElQAIf20cbIePuXUy6SY8C6KMoXSk= -github.com/zeromicro/go-zero/tools/goctl v1.5.1/go.mod h1:e4uMXvD5R0n3E9g0mhC2Uzmv4ZeKt3yJMFEKYRVJEe0= go.etcd.io/etcd/api/v3 v3.5.5/go.mod h1:KFtNaxGDw4Yx/BA4iPPwevUTAuqcsPxzyX8PHydchN8= go.etcd.io/etcd/api/v3 v3.5.7 h1:sbcmosSVesNrWOJ58ZQFitHMdncusIifYcrBfwrlJSY= go.etcd.io/etcd/api/v3 v3.5.7/go.mod h1:9qew1gCdDDLu+VwmeG+iFpL+QlpHTo7iubavdVDgCAA= @@ -1363,6 +1339,7 @@ golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220909162455-aba9fc2a8ff2/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=