From 47d81fd2c7af5a66bca701b47c9b572c526c1c58 Mon Sep 17 00:00:00 2001 From: wangjian Date: Wed, 5 Apr 2023 21:03:40 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=BF=AE=E6=94=B9=E6=88=90=E6=9C=80?= =?UTF-8?q?=E6=96=B0=E7=9A=84=E6=A0=B8=E5=BF=83=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/config.go | 2 +- go.mod | 20 ++++++++++---------- mq/index.go | 7 ++++--- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/config/config.go b/config/config.go index 85199a7..c45396a 100644 --- a/config/config.go +++ b/config/config.go @@ -64,7 +64,7 @@ type HpdsNode struct { type FuncConfig struct { Name string `yaml:"name"` - DataTag uint8 `yaml:"dataTag"` + DataTag uint32 `yaml:"dataTag"` MqType uint `yaml:"mqType"` //消息类型, 发布,1;订阅;2 } diff --git a/go.mod b/go.mod index 34f5f9c..77b39ba 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,8 @@ go 1.19 require ( git.hpds.cc/Component/logging v0.0.0-20230106105738-e378e873921b - git.hpds.cc/pavement/hpds_node v0.0.0-20230402152619-41414aafa930 + git.hpds.cc/Component/network v0.0.0-20230405125523-abb93c020ff5 + git.hpds.cc/pavement/hpds_node v0.0.0-20230405125907-be7c3e11c61e github.com/go-sql-driver/mysql v1.7.0 github.com/hashicorp/consul/api v1.20.0 github.com/klauspost/compress v1.16.3 @@ -23,7 +24,6 @@ require ( cloud.google.com/go/firestore v1.9.0 // indirect cloud.google.com/go/longrunning v0.3.0 // indirect git.hpds.cc/Component/mq_coder v0.0.0-20221010064749-174ae7ae3340 // indirect - git.hpds.cc/Component/network v0.0.0-20230402152327-d10a80765e7c // indirect github.com/armon/go-metrics v0.4.0 // indirect github.com/coreos/go-semver v0.3.0 // indirect github.com/coreos/go-systemd/v22 v22.3.2 // indirect @@ -38,6 +38,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/go-cmp v0.5.9 // indirect + github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect github.com/google/uuid v1.3.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.2.1 // indirect github.com/googleapis/gax-go/v2 v2.7.0 // indirect @@ -51,10 +52,7 @@ require ( github.com/inconshreveable/mousetrap v1.0.1 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/cpuid/v2 v2.2.4 // indirect - github.com/lucas-clemente/quic-go v0.29.1 // indirect github.com/magiconair/properties v1.8.7 // indirect - github.com/marten-seemann/qtls-go1-18 v0.1.2 // indirect - github.com/marten-seemann/qtls-go1-19 v0.1.0 // indirect github.com/matoous/go-nanoid/v2 v2.0.0 // indirect github.com/mattn/go-colorable v0.1.12 // indirect github.com/mattn/go-isatty v0.0.14 // indirect @@ -64,10 +62,13 @@ require ( github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/nxadm/tail v1.4.8 // indirect github.com/onsi/ginkgo v1.16.4 // indirect + github.com/onsi/ginkgo/v2 v2.2.0 // indirect github.com/pelletier/go-toml/v2 v2.0.6 // indirect github.com/pkg/errors v0.9.1 // indirect + github.com/quic-go/qtls-go1-19 v0.2.1 // indirect + github.com/quic-go/qtls-go1-20 v0.1.1 // indirect + github.com/quic-go/quic-go v0.33.0 // indirect github.com/rs/xid v1.4.0 // indirect github.com/sagikazarmark/crypt v0.9.0 // indirect github.com/sirupsen/logrus v1.9.0 // indirect @@ -85,15 +86,15 @@ require ( go.uber.org/atomic v1.9.0 // indirect go.uber.org/multierr v1.8.0 // indirect golang.org/x/crypto v0.6.0 // indirect - golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect - golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect + golang.org/x/exp v0.0.0-20221205204356-47842c84f3db // indirect + golang.org/x/mod v0.6.0 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect golang.org/x/sync v0.1.0 // indirect golang.org/x/sys v0.5.0 // indirect golang.org/x/text v0.7.0 // indirect golang.org/x/time v0.1.0 // indirect - golang.org/x/tools v0.1.12 // indirect + golang.org/x/tools v0.2.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/api v0.107.0 // indirect google.golang.org/appengine v1.6.7 // indirect @@ -102,6 +103,5 @@ require ( google.golang.org/protobuf v1.28.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect - gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect xorm.io/builder v0.3.11-0.20220531020008-1bd24a7dc978 // indirect ) diff --git a/mq/index.go b/mq/index.go index 6c551b5..7b56792 100644 --- a/mq/index.go +++ b/mq/index.go @@ -6,6 +6,7 @@ import ( "encoding/base64" "encoding/json" "fmt" + "git.hpds.cc/Component/network/frame" "github.com/minio/minio-go/v7" "os" "path" @@ -43,7 +44,7 @@ func NewMqClient(funcs []config.FuncConfig, node config.HpdsNode) (mqList []Hpds sf := hpds_node.NewStreamFunction( v.Name, hpds_node.WithMqAddr(fmt.Sprintf("%s:%d", node.Host, node.Port)), - hpds_node.WithObserveDataTags(v.DataTag), + hpds_node.WithObserveDataTags(frame.Tag(v.DataTag)), hpds_node.WithCredential(node.Token), ) _ = sf.SetHandler(handler) @@ -71,7 +72,7 @@ func NewMqClient(funcs []config.FuncConfig, node config.HpdsNode) (mqList []Hpds EndPoint: ap, } must(err) - ap.SetDataTag(v.DataTag) + ap.SetDataTag(frame.Tag(v.DataTag)) mqList = append(mqList, nodeInfo) } @@ -97,7 +98,7 @@ func GenerateAndSendData(stream hpds_node.AccessPoint, data []byte) error { return nil } -func handler(data []byte) (byte, []byte) { +func handler(data []byte) (frame.Tag, []byte) { req := new(InstructionReq) err := json.Unmarshal(data, req) if err != nil {