From 2df8040642992ccfef41ab033894e89f7ec75b86 Mon Sep 17 00:00:00 2001 From: KuiLiao Date: Wed, 6 Apr 2022 00:21:47 +0800 Subject: [PATCH 01/16] update nacos --- conf.sample.yml | 38 +++++++++++++++++++------------------- dtmsvr/config/config.go | 7 ++++--- dtmsvr/svr.go | 25 +++++++++++++++++++++++-- go.mod | 1 + go.sum | 20 ++++++++++++++++++++ main.go | 2 ++ 6 files changed, 69 insertions(+), 24 deletions(-) diff --git a/conf.sample.yml b/conf.sample.yml index ec3ec8b..5ea5a3d 100644 --- a/conf.sample.yml +++ b/conf.sample.yml @@ -5,7 +5,12 @@ ### MicroService.EndPoint => MICRO_SERVICE_END_POINT ##################################################################### -# Store: # specify which engine to store trans status +Store: # specify which engine to store trans status + Driver: 'mysql' + Host: 'localhost' + User: 'root' + Password: '123456' + Port: 3306 # Driver: 'boltdb' # default store engine # Driver: 'redis' @@ -14,12 +19,6 @@ # Password: '' # Port: 6379 -# Driver: 'mysql' -# Host: 'localhost' -# User: 'root' -# Password: '' -# Port: 3306 - # Driver: 'postgres' # Host: 'localhost' # User: 'postgres' @@ -38,10 +37,11 @@ # SuccessDataExpire: 86400 # successful Trans data will expire in 1 days. only for redis. # RedisPrefix: '{a}' # default value is '{a}'. Redis storage prefix. store data to only one slot in cluster -# MicroService: -# Driver: 'dtm-driver-gozero' # name of the driver to handle register/discover -# Target: 'etcd://localhost:2379/dtmservice' # register dtm server to this url -# EndPoint: 'localhost:36790' +MicroService: + Driver: 'dtm-driver-nacos' # name of the driver to handle register/discover + Target: '121.4.131.37:8848' # register dtm server to this url + EndPoint: '192.168.101.9:26789' + OptionsJson: '{"username": "nacos", "password": "nacos", "namespaceId": "8c8d6e54-33dd-4d76-b69b-3f477d6ebf59"}' # micro service other config message, example: '{"username": "nacos", "password": "nacos"}' ### the unit of following configurations is second # TransCronInterval: 3 # the interval to poll unfinished global transaction for every dtm process @@ -49,15 +49,15 @@ # RetryInterval: 10 # the subtrans branch will be retried after this interval # RequestTimeout: 3 # the timeout of HTTP/gRPC request in dtm -# LogLevel: 'info' # default: info. can be debug|info|warn|error -# Log: -# Outputs: 'stderr' # default: stderr, split by ",", you can append files to Outputs if need. example:'stderr,/tmp/test.log' -# RotationEnable: 0 # default: 0 -# RotationConfigJSON: '{}' # example: '{"maxsize": 100, "maxage": 0, "maxbackups": 0, "localtime": false, "compress": false}' +LogLevel: 'info' # default: info. can be debug|info|warn|error +Log: + Outputs: 'stderr' # default: stderr, split by ",", you can append files to Outputs if need. example:'stderr,/tmp/test.log' + RotationEnable: 0 # default: 0 + RotationConfigJSON: '{}' # example: '{"maxsize": 100, "maxage": 0, "maxbackups": 0, "localtime": false, "compress": false}' -# HttpPort: 36789 -# GrpcPort: 36790 -# JsonRpcPort: 36791 +HttpPort: 36789 +GrpcPort: 36790 +JsonRpcPort: 36791 ### advanced options # UpdateBranchAsyncGoroutineNum: 1 # num of async goroutine to update branch status diff --git a/dtmsvr/config/config.go b/dtmsvr/config/config.go index f64fa32..00d9684 100644 --- a/dtmsvr/config/config.go +++ b/dtmsvr/config/config.go @@ -24,9 +24,10 @@ const ( // MicroService config type for micro service type MicroService struct { - Driver string `yaml:"Driver" default:"default"` - Target string `yaml:"Target"` - EndPoint string `yaml:"EndPoint"` + Driver string `yaml:"Driver" default:"dtm-driver-nacos"` + Target string `yaml:"Target"` + EndPoint string `yaml:"EndPoint"` + OptionsJson string `yaml:"OptionsJson"` } // Log config customize log diff --git a/dtmsvr/svr.go b/dtmsvr/svr.go index a9f266f..847bd41 100644 --- a/dtmsvr/svr.go +++ b/dtmsvr/svr.go @@ -8,7 +8,9 @@ package dtmsvr import ( "context" + "encoding/json" "fmt" + "github.com/horseLk/dtmdriver-nacos/httpdriver" "net" "time" @@ -70,8 +72,27 @@ func StartSvr() { time.Sleep(100 * time.Millisecond) err = dtmdriver.Use(conf.MicroService.Driver) logger.FatalIfError(err) - logger.Infof("RegisterGrpcService: %s", conf.MicroService.Driver) - err = dtmdriver.GetDriver().RegisterGrpcService(conf.MicroService.Target, conf.MicroService.EndPoint) + + if v, ok := dtmdriver.GetDriver().(httpdriver.HttpDriver); ok { + logger.Infof("RegisterHttpSerrvice: %s", v) + options := make(map[string]string) + if conf.MicroService.OptionsJson == "" { + conf.MicroService.OptionsJson = "{}" + } + err = json.Unmarshal([]byte(conf.MicroService.OptionsJson), &options) + if err != nil { + logger.FatalIfError(err) + } + routesInfo := app.Routes() + paths := make([]string, 0) + for _, routeInfo := range routesInfo { + paths = append(paths, routeInfo.Path) + } + err = v.RegisterHttpService(conf.MicroService.Target, conf.MicroService.EndPoint, options, paths) + } else { + logger.Infof("RegisterGrpcService: %s", conf.MicroService.Driver) + err = dtmdriver.GetDriver().RegisterGrpcService(conf.MicroService.Target, conf.MicroService.EndPoint) + } logger.FatalIfError(err) } diff --git a/go.mod b/go.mod index 5d9206a..e58db31 100644 --- a/go.mod +++ b/go.mod @@ -14,6 +14,7 @@ require ( github.com/go-redis/redis/v8 v8.11.4 github.com/go-resty/resty/v2 v2.7.0 github.com/go-sql-driver/mysql v1.6.0 + github.com/horseLk/dtmdriver-nacos v1.0.4 github.com/lib/pq v1.10.4 github.com/lithammer/shortuuid v2.0.3+incompatible github.com/lithammer/shortuuid/v3 v3.0.7 diff --git a/go.sum b/go.sum index c67d3e1..b2170c3 100644 --- a/go.sum +++ b/go.sum @@ -56,6 +56,8 @@ github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= github.com/alicebob/miniredis/v2 v2.17.0/go.mod h1:gquAfGbzn92jvtrSC69+6zZnwSODVXVpYDRaGhWaL6I= +github.com/aliyun/alibaba-cloud-sdk-go v1.61.18 h1:zOVTBdCKFd9JbCKz9/nt+FovbjPFmb7mUnp8nH9fQBA= +github.com/aliyun/alibaba-cloud-sdk-go v1.61.18/go.mod h1:v8ESoHo4SyHmuB4b1tJqDHxfTGEciD+yhvOU/5s1Rfk= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= @@ -65,6 +67,8 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bkaradzic/go-lz4 v1.0.0/go.mod h1:0YdlkowM3VswSROI7qDxhRvJ3sLhlFrRRwjwegp5jy4= +github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs= +github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= @@ -144,6 +148,8 @@ github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm github.com/gin-gonic/gin v1.7.7 h1:3DoBmSbJbZAWqXJC3SLjAPfutPJJRN1U5pALB7EeTTs= github.com/gin-gonic/gin v1.7.7/go.mod h1:axIBovoeJpVj8S3BwE0uPMTeReE4+AfFtqpqaZ1qq1U= github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= +github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w= +github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -203,6 +209,7 @@ github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRx github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d/go.mod h1:nnjvkQ9ptGaCkuDUx6wNykzzlUixGxvkme+H/lnzb+A= github.com/golang-jwt/jwt/v4 v4.2.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -290,6 +297,10 @@ github.com/hashicorp/go-uuid v1.0.2/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 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/horseLk/dtmdriver-nacos v1.0.3 h1:dGd8qHG+XWfohprrTmBoVbR+OJeu4/z4d3jlXOSucBA= +github.com/horseLk/dtmdriver-nacos v1.0.3/go.mod h1:sLy9zEQ50isWNDbcxOXf50+PBdYfRTUpA4MUsr0uhPQ= +github.com/horseLk/dtmdriver-nacos v1.0.4 h1:0kcPQhCVMen+UPLJdX9jzfwj5hRcGsIr/crx436Ng7g= +github.com/horseLk/dtmdriver-nacos v1.0.4/go.mod h1:sLy9zEQ50isWNDbcxOXf50+PBdYfRTUpA4MUsr0uhPQ= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= @@ -352,8 +363,11 @@ github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkr github.com/jinzhu/now v1.1.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/jinzhu/now v1.1.2 h1:eVKgfIdy9b6zbWBMgFpfDPoAMifwSZagU9HmEU6zgiI= github.com/jinzhu/now v1.1.2/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= +github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -425,6 +439,8 @@ github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8m github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= +github.com/nacos-group/nacos-sdk-go v1.1.1 h1:beczWcOoTaVBMgCgikqvZflrN5Xbw7pWAWpxl+VJGIA= +github.com/nacos-group/nacos-sdk-go v1.1.1/go.mod h1:UHOtQNQY/qpk2dhg6gDq8u5+/CEIc3+lWmrmxEzX0/g= github.com/natefinch/lumberjack v2.0.0+incompatible h1:4QJd3OLAMgj7ph+yZTuX13Ld4UpgHp07nNdFX7mqFfM= github.com/natefinch/lumberjack v2.0.0+incompatible/go.mod h1:Wi9p2TTF5DG5oU+6YfsmYQpsTIOm0B1VNzQg9Mw6nPk= github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms= @@ -502,6 +518,7 @@ github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrf github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= @@ -598,6 +615,7 @@ go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9E go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= +go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI= go.uber.org/zap v1.21.0 h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8= @@ -915,6 +933,8 @@ gopkg.in/h2non/gock.v1 v1.1.2/go.mod h1:n7UGz/ckNChHiK05rDoiC4MYSunEC/lyaUm2WWaD gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/ini.v1 v1.42.0 h1:7N3gPTt50s8GuLortA00n8AqRTk75qOP98+mTPpgzRk= +gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= diff --git a/main.go b/main.go index dd5c791..49aba15 100644 --- a/main.go +++ b/main.go @@ -24,6 +24,7 @@ import ( _ "github.com/dtm-labs/dtmdriver-kratos" _ "github.com/dtm-labs/dtmdriver-polaris" _ "github.com/dtm-labs/dtmdriver-protocol1" + _ "github.com/horseLk/dtmdriver-nacos" ) // Version declares version info @@ -59,6 +60,7 @@ func main() { return } logger.Infof("dtm version is: %s", Version) + *confFile = "conf.sample.yml" config.MustLoadConfig(*confFile) conf := &config.Config if *isDebug { From 0db4ffbbc4d7355e98ab4d538ce7d432fb7182b5 Mon Sep 17 00:00:00 2001 From: KuiLiao Date: Wed, 6 Apr 2022 17:20:17 +0800 Subject: [PATCH 02/16] update --- conf.sample.yml | 6 +++--- go.mod | 2 +- go.sum | 6 ++---- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/conf.sample.yml b/conf.sample.yml index 5ea5a3d..c0f244a 100644 --- a/conf.sample.yml +++ b/conf.sample.yml @@ -39,9 +39,9 @@ Store: # specify which engine to store trans status MicroService: Driver: 'dtm-driver-nacos' # name of the driver to handle register/discover - Target: '121.4.131.37:8848' # register dtm server to this url - EndPoint: '192.168.101.9:26789' - OptionsJson: '{"username": "nacos", "password": "nacos", "namespaceId": "8c8d6e54-33dd-4d76-b69b-3f477d6ebf59"}' # micro service other config message, example: '{"username": "nacos", "password": "nacos"}' + Target: '1.14.127.29:8848' # register dtm server to this url + EndPoint: '192.168.101.9:36789' + OptionsJson: '{"username": "nacos", "password": "nacos", "namespaceId": "c3dc917d-906a-429d-90a9-85012b41014e"}' # micro service other config message, example: '{"username": "nacos", "password": "nacos"}' ### the unit of following configurations is second # TransCronInterval: 3 # the interval to poll unfinished global transaction for every dtm process diff --git a/go.mod b/go.mod index e58db31..40c778d 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/go-redis/redis/v8 v8.11.4 github.com/go-resty/resty/v2 v2.7.0 github.com/go-sql-driver/mysql v1.6.0 - github.com/horseLk/dtmdriver-nacos v1.0.4 + github.com/horseLk/dtmdriver-nacos v1.0.5 github.com/lib/pq v1.10.4 github.com/lithammer/shortuuid v2.0.3+incompatible github.com/lithammer/shortuuid/v3 v3.0.7 diff --git a/go.sum b/go.sum index b2170c3..53e2966 100644 --- a/go.sum +++ b/go.sum @@ -297,10 +297,8 @@ github.com/hashicorp/go-uuid v1.0.2/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 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/horseLk/dtmdriver-nacos v1.0.3 h1:dGd8qHG+XWfohprrTmBoVbR+OJeu4/z4d3jlXOSucBA= -github.com/horseLk/dtmdriver-nacos v1.0.3/go.mod h1:sLy9zEQ50isWNDbcxOXf50+PBdYfRTUpA4MUsr0uhPQ= -github.com/horseLk/dtmdriver-nacos v1.0.4 h1:0kcPQhCVMen+UPLJdX9jzfwj5hRcGsIr/crx436Ng7g= -github.com/horseLk/dtmdriver-nacos v1.0.4/go.mod h1:sLy9zEQ50isWNDbcxOXf50+PBdYfRTUpA4MUsr0uhPQ= +github.com/horseLk/dtmdriver-nacos v1.0.5 h1:M6RGpRHSOObkOl2KdIEfWbQCwsJI6OGJXvcWuozKMiY= +github.com/horseLk/dtmdriver-nacos v1.0.5/go.mod h1:sLy9zEQ50isWNDbcxOXf50+PBdYfRTUpA4MUsr0uhPQ= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= From 6ef72f747a0f11f16f8f62a7d46b25e3fe084dde Mon Sep 17 00:00:00 2001 From: KuiLiao Date: Fri, 8 Apr 2022 18:39:11 +0800 Subject: [PATCH 03/16] revivification --- conf.sample.yml | 40 ++++++++++++++++++++-------------------- dtmsvr/config/config.go | 2 +- main.go | 1 - 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/conf.sample.yml b/conf.sample.yml index c0f244a..6ce8e73 100644 --- a/conf.sample.yml +++ b/conf.sample.yml @@ -5,12 +5,12 @@ ### MicroService.EndPoint => MICRO_SERVICE_END_POINT ##################################################################### -Store: # specify which engine to store trans status - Driver: 'mysql' - Host: 'localhost' - User: 'root' - Password: '123456' - Port: 3306 +# Store: # specify which engine to store trans status +# Driver: 'mysql' +# Host: 'localhost' +# User: 'root' +# Password: '123456' +# Port: 3306 # Driver: 'boltdb' # default store engine # Driver: 'redis' @@ -37,11 +37,11 @@ Store: # specify which engine to store trans status # SuccessDataExpire: 86400 # successful Trans data will expire in 1 days. only for redis. # RedisPrefix: '{a}' # default value is '{a}'. Redis storage prefix. store data to only one slot in cluster -MicroService: - Driver: 'dtm-driver-nacos' # name of the driver to handle register/discover - Target: '1.14.127.29:8848' # register dtm server to this url - EndPoint: '192.168.101.9:36789' - OptionsJson: '{"username": "nacos", "password": "nacos", "namespaceId": "c3dc917d-906a-429d-90a9-85012b41014e"}' # micro service other config message, example: '{"username": "nacos", "password": "nacos"}' +# MicroService: +# Driver: 'dtm-driver-nacos' # name of the driver to handle register/discover +# Target: '127.0.0.1:8848' # register dtm server to this url +# EndPoint: '127.0.0.1:36789' +# OptionsJson: '{"username": "nacos", "password": "nacos", "namespaceId": "c3dc917d-906a-429d-90a9-85012b41067e"}' # micro service other config message, example: '{"username": "nacos", "password": "nacos"}' ### the unit of following configurations is second # TransCronInterval: 3 # the interval to poll unfinished global transaction for every dtm process @@ -49,15 +49,15 @@ MicroService: # RetryInterval: 10 # the subtrans branch will be retried after this interval # RequestTimeout: 3 # the timeout of HTTP/gRPC request in dtm -LogLevel: 'info' # default: info. can be debug|info|warn|error -Log: - Outputs: 'stderr' # default: stderr, split by ",", you can append files to Outputs if need. example:'stderr,/tmp/test.log' - RotationEnable: 0 # default: 0 - RotationConfigJSON: '{}' # example: '{"maxsize": 100, "maxage": 0, "maxbackups": 0, "localtime": false, "compress": false}' - -HttpPort: 36789 -GrpcPort: 36790 -JsonRpcPort: 36791 +# LogLevel: 'info' # default: info. can be debug|info|warn|error +# Log: +# Outputs: 'stderr' # default: stderr, split by ",", you can append files to Outputs if need. example:'stderr,/tmp/test.log' +# RotationEnable: 0 # default: 0 +# RotationConfigJSON: '{}' # example: '{"maxsize": 100, "maxage": 0, "maxbackups": 0, "localtime": false, "compress": false}' +# +# HttpPort: 36789 +# GrpcPort: 36790 +# JsonRpcPort: 36791 ### advanced options # UpdateBranchAsyncGoroutineNum: 1 # num of async goroutine to update branch status diff --git a/dtmsvr/config/config.go b/dtmsvr/config/config.go index 00d9684..ac9cf6f 100644 --- a/dtmsvr/config/config.go +++ b/dtmsvr/config/config.go @@ -24,7 +24,7 @@ const ( // MicroService config type for micro service type MicroService struct { - Driver string `yaml:"Driver" default:"dtm-driver-nacos"` + Driver string `yaml:"Driver" default:"default"` Target string `yaml:"Target"` EndPoint string `yaml:"EndPoint"` OptionsJson string `yaml:"OptionsJson"` diff --git a/main.go b/main.go index 49aba15..44dcd71 100644 --- a/main.go +++ b/main.go @@ -60,7 +60,6 @@ func main() { return } logger.Infof("dtm version is: %s", Version) - *confFile = "conf.sample.yml" config.MustLoadConfig(*confFile) conf := &config.Config if *isDebug { From 2fae6796069fccbaaba9de199139488d577325df Mon Sep 17 00:00:00 2001 From: KuiLiao Date: Mon, 11 Apr 2022 22:35:55 +0800 Subject: [PATCH 04/16] update resolver --- dtmsvr/svr.go | 2 +- dtmsvr/trans_status.go | 13 ++++++++++++- go.mod | 2 +- go.sum | 2 ++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/dtmsvr/svr.go b/dtmsvr/svr.go index 847bd41..1a168b7 100644 --- a/dtmsvr/svr.go +++ b/dtmsvr/svr.go @@ -88,7 +88,7 @@ func StartSvr() { for _, routeInfo := range routesInfo { paths = append(paths, routeInfo.Path) } - err = v.RegisterHttpService(conf.MicroService.Target, conf.MicroService.EndPoint, options, paths) + err = v.RegisterHttpService(conf.MicroService.Target, conf.MicroService.EndPoint, options) } else { logger.Infof("RegisterGrpcService: %s", conf.MicroService.Driver) err = dtmdriver.GetDriver().RegisterGrpcService(conf.MicroService.Target, conf.MicroService.EndPoint) diff --git a/dtmsvr/trans_status.go b/dtmsvr/trans_status.go index 3e8495e..b154a4b 100644 --- a/dtmsvr/trans_status.go +++ b/dtmsvr/trans_status.go @@ -9,6 +9,7 @@ package dtmsvr import ( "errors" "fmt" + "github.com/horseLk/dtmdriver-nacos/httpdriver" "net/url" "strings" "time" @@ -173,7 +174,17 @@ func (t *TransGlobal) getURLResult(uri string, branchID, op string, branchPayloa } func (t *TransGlobal) getBranchResult(branch *TransBranch) (string, error) { - err := t.getURLResult(branch.URL, branch.BranchID, branch.Op, branch.BinData) + branchUrl := branch.URL + // means use http driver, must resolve url + if strings.HasPrefix(branchUrl, dtmdriver.GetDriver().GetName()) { + curDriver := dtmdriver.GetDriver().(httpdriver.HttpDriver) + realUrl, err := curDriver.ResolveHttpService(branchUrl) + if err != nil { + return dtmcli.StatusFailed, err + } + branchUrl = realUrl + } + err := t.getURLResult(branchUrl, branch.BranchID, branch.Op, branch.BinData) if err == nil { return dtmcli.StatusSucceed, nil } else if t.TransType == "saga" && branch.Op == dtmimp.OpAction && errors.Is(err, dtmcli.ErrFailure) { diff --git a/go.mod b/go.mod index 40c778d..c99c97c 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/go-redis/redis/v8 v8.11.4 github.com/go-resty/resty/v2 v2.7.0 github.com/go-sql-driver/mysql v1.6.0 - github.com/horseLk/dtmdriver-nacos v1.0.5 + github.com/horseLk/dtmdriver-nacos v1.0.6 github.com/lib/pq v1.10.4 github.com/lithammer/shortuuid v2.0.3+incompatible github.com/lithammer/shortuuid/v3 v3.0.7 diff --git a/go.sum b/go.sum index 53e2966..510be21 100644 --- a/go.sum +++ b/go.sum @@ -299,6 +299,8 @@ github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/horseLk/dtmdriver-nacos v1.0.5 h1:M6RGpRHSOObkOl2KdIEfWbQCwsJI6OGJXvcWuozKMiY= github.com/horseLk/dtmdriver-nacos v1.0.5/go.mod h1:sLy9zEQ50isWNDbcxOXf50+PBdYfRTUpA4MUsr0uhPQ= +github.com/horseLk/dtmdriver-nacos v1.0.6 h1:u9Zxap0Q/w3DtoUyeLaalGn1MaMl7tD+ttAs7uSwYns= +github.com/horseLk/dtmdriver-nacos v1.0.6/go.mod h1:sLy9zEQ50isWNDbcxOXf50+PBdYfRTUpA4MUsr0uhPQ= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= From 2893357ee8690a5626ef7dedd0bc3e3475a9ef76 Mon Sep 17 00:00:00 2001 From: xyctruth Date: Thu, 14 Apr 2022 16:32:33 +0800 Subject: [PATCH 05/16] optimize wait store up log --- dtmsvr/storage/registry/registry.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dtmsvr/storage/registry/registry.go b/dtmsvr/storage/registry/registry.go index e699bd3..7a2105b 100644 --- a/dtmsvr/storage/registry/registry.go +++ b/dtmsvr/storage/registry/registry.go @@ -3,6 +3,8 @@ package registry import ( "time" + "github.com/dtm-labs/dtm/dtmcli/logger" + "github.com/dtm-labs/dtm/dtmsvr/config" "github.com/dtm-labs/dtm/dtmsvr/storage" "github.com/dtm-labs/dtm/dtmsvr/storage/boltdb" @@ -48,5 +50,6 @@ func GetStore() storage.Store { func WaitStoreUp() { for err := GetStore().Ping(); err != nil; err = GetStore().Ping() { time.Sleep(3 * time.Second) + logger.Infof("wait store up") } } From 5739d62fc15708ecf715acb814bb0b3a0ca7f004 Mon Sep 17 00:00:00 2001 From: xyctruth Date: Thu, 14 Apr 2022 16:43:17 +0800 Subject: [PATCH 06/16] log before sleep --- dtmsvr/storage/registry/registry.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dtmsvr/storage/registry/registry.go b/dtmsvr/storage/registry/registry.go index 7a2105b..35df62a 100644 --- a/dtmsvr/storage/registry/registry.go +++ b/dtmsvr/storage/registry/registry.go @@ -49,7 +49,7 @@ func GetStore() storage.Store { // WaitStoreUp wait for db to go up func WaitStoreUp() { for err := GetStore().Ping(); err != nil; err = GetStore().Ping() { - time.Sleep(3 * time.Second) logger.Infof("wait store up") + time.Sleep(3 * time.Second) } } From bfae89afc446a591b838c937593c2b735f113e8e Mon Sep 17 00:00:00 2001 From: KuiLiao Date: Thu, 14 Apr 2022 17:16:29 +0800 Subject: [PATCH 07/16] update httpdriver interface --- dtmsvr/trans_status.go | 15 +++++---------- go.mod | 2 +- go.sum | 6 ++---- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/dtmsvr/trans_status.go b/dtmsvr/trans_status.go index b154a4b..51f0ecd 100644 --- a/dtmsvr/trans_status.go +++ b/dtmsvr/trans_status.go @@ -174,17 +174,12 @@ func (t *TransGlobal) getURLResult(uri string, branchID, op string, branchPayloa } func (t *TransGlobal) getBranchResult(branch *TransBranch) (string, error) { - branchUrl := branch.URL - // means use http driver, must resolve url - if strings.HasPrefix(branchUrl, dtmdriver.GetDriver().GetName()) { - curDriver := dtmdriver.GetDriver().(httpdriver.HttpDriver) - realUrl, err := curDriver.ResolveHttpService(branchUrl) - if err != nil { - return dtmcli.StatusFailed, err - } - branchUrl = realUrl + realUrl := branch.URL + // resolver http url. + if v, ok := dtmdriver.GetDriver().(httpdriver.HttpDriver); ok { + realUrl = v.ResolveHttpService(branch.URL) } - err := t.getURLResult(branchUrl, branch.BranchID, branch.Op, branch.BinData) + err := t.getURLResult(realUrl, branch.BranchID, branch.Op, branch.BinData) if err == nil { return dtmcli.StatusSucceed, nil } else if t.TransType == "saga" && branch.Op == dtmimp.OpAction && errors.Is(err, dtmcli.ErrFailure) { diff --git a/go.mod b/go.mod index c99c97c..e50738c 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/go-redis/redis/v8 v8.11.4 github.com/go-resty/resty/v2 v2.7.0 github.com/go-sql-driver/mysql v1.6.0 - github.com/horseLk/dtmdriver-nacos v1.0.6 + github.com/horseLk/dtmdriver-nacos v1.0.9 github.com/lib/pq v1.10.4 github.com/lithammer/shortuuid v2.0.3+incompatible github.com/lithammer/shortuuid/v3 v3.0.7 diff --git a/go.sum b/go.sum index 510be21..3e01601 100644 --- a/go.sum +++ b/go.sum @@ -297,10 +297,8 @@ github.com/hashicorp/go-uuid v1.0.2/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 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/horseLk/dtmdriver-nacos v1.0.5 h1:M6RGpRHSOObkOl2KdIEfWbQCwsJI6OGJXvcWuozKMiY= -github.com/horseLk/dtmdriver-nacos v1.0.5/go.mod h1:sLy9zEQ50isWNDbcxOXf50+PBdYfRTUpA4MUsr0uhPQ= -github.com/horseLk/dtmdriver-nacos v1.0.6 h1:u9Zxap0Q/w3DtoUyeLaalGn1MaMl7tD+ttAs7uSwYns= -github.com/horseLk/dtmdriver-nacos v1.0.6/go.mod h1:sLy9zEQ50isWNDbcxOXf50+PBdYfRTUpA4MUsr0uhPQ= +github.com/horseLk/dtmdriver-nacos v1.0.8 h1:/H0KVGBQlrHa0wzhuLfw7hMKf1+/WtMuhJ9JtUC5NPc= +github.com/horseLk/dtmdriver-nacos v1.0.8/go.mod h1:uJ6ZMW2tuRtbvNSJdG7ewsuoy9SEPHWkCH085igFtO8= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= From 586624a9c796e17a64e0815b88a902f05af25125 Mon Sep 17 00:00:00 2001 From: KuiLiao Date: Thu, 14 Apr 2022 17:31:57 +0800 Subject: [PATCH 08/16] update mod --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index e50738c..0268828 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/go-redis/redis/v8 v8.11.4 github.com/go-resty/resty/v2 v2.7.0 github.com/go-sql-driver/mysql v1.6.0 - github.com/horseLk/dtmdriver-nacos v1.0.9 + github.com/horseLk/dtmdriver-nacos v1.1.0 github.com/lib/pq v1.10.4 github.com/lithammer/shortuuid v2.0.3+incompatible github.com/lithammer/shortuuid/v3 v3.0.7 diff --git a/go.sum b/go.sum index 3e01601..f01200a 100644 --- a/go.sum +++ b/go.sum @@ -297,8 +297,8 @@ github.com/hashicorp/go-uuid v1.0.2/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 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/horseLk/dtmdriver-nacos v1.0.8 h1:/H0KVGBQlrHa0wzhuLfw7hMKf1+/WtMuhJ9JtUC5NPc= -github.com/horseLk/dtmdriver-nacos v1.0.8/go.mod h1:uJ6ZMW2tuRtbvNSJdG7ewsuoy9SEPHWkCH085igFtO8= +github.com/horseLk/dtmdriver-nacos v1.1.0 h1:cIY7m8x/f/PR/Cc4fbLUMAvZjiibz36KbXn10Eax9WA= +github.com/horseLk/dtmdriver-nacos v1.1.0/go.mod h1:I1r1wXt+WsbtiMKZR1SbX9qLQzL3Sli9Gp3zAZBrAnA= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= From 7414304ea6922536f015fd9d776c3dc56b5a8944 Mon Sep 17 00:00:00 2001 From: yedf2 <120050102@qq.com> Date: Fri, 15 Apr 2022 12:34:55 +0800 Subject: [PATCH 09/16] yedf --- .gitignore | 2 ++ conf.sample.yml | 13 +++++++------ dtmcli/dtmimp/vars.go | 6 +++++- dtmsvr/config/config.go | 36 +++++++++++++++++++++++------------- dtmsvr/svr.go | 32 ++++++++++---------------------- go.mod | 4 ++++ 6 files changed, 51 insertions(+), 42 deletions(-) diff --git a/.gitignore b/.gitignore index 3235773..19c6224 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ test.sh dtm dtm-* dtm.* +cache + diff --git a/conf.sample.yml b/conf.sample.yml index 6ce8e73..8ceb79f 100644 --- a/conf.sample.yml +++ b/conf.sample.yml @@ -37,12 +37,13 @@ # SuccessDataExpire: 86400 # successful Trans data will expire in 1 days. only for redis. # RedisPrefix: '{a}' # default value is '{a}'. Redis storage prefix. store data to only one slot in cluster -# MicroService: -# Driver: 'dtm-driver-nacos' # name of the driver to handle register/discover -# Target: '127.0.0.1:8848' # register dtm server to this url -# EndPoint: '127.0.0.1:36789' -# OptionsJson: '{"username": "nacos", "password": "nacos", "namespaceId": "c3dc917d-906a-429d-90a9-85012b41067e"}' # micro service other config message, example: '{"username": "nacos", "password": "nacos"}' - +HttpMicroService: + Driver: 'dtm-driver-http' + RegistryType: 'nacos' + RegistryAddress: '127.0.0.1:8848,127.0.0.1:8848' + RegistryOptions: '{"UserName":"nacos","Password":"nacos","NotLoadCacheAtStart":true}' + Target: '{"ServiceName":"dtm","Enable":true,"Healthy":true,"Weight":10}' + EndPoint: '127.0.0.1:36789' ### the unit of following configurations is second # TransCronInterval: 3 # the interval to poll unfinished global transaction for every dtm process # TimeoutToFail: 35 # timeout for XA, TCC to fail. saga's timeout default to infinite, which can be overwritten in saga options diff --git a/dtmcli/dtmimp/vars.go b/dtmcli/dtmimp/vars.go index 3b30403..e9d265b 100644 --- a/dtmcli/dtmimp/vars.go +++ b/dtmcli/dtmimp/vars.go @@ -10,6 +10,7 @@ import ( "errors" "github.com/dtm-labs/dtm/dtmcli/logger" + "github.com/dtm-labs/dtmdriver" "github.com/go-resty/resty/v2" ) @@ -44,8 +45,11 @@ var BarrierTableName = "dtm_barrier.barrier" func init() { RestyClient.OnBeforeRequest(func(c *resty.Client, r *resty.Request) error { r.URL = MayReplaceLocalhost(r.URL) + u, err := dtmdriver.GetHTTPDriver().ResolveURL(r.URL) logger.Debugf("requesting: %s %s %s", r.Method, r.URL, MustMarshalString(r.Body)) - return nil + r.URL = u + logger.Debugf("resolved: %s err: %v", r.URL, err) + return err }) RestyClient.OnAfterResponse(func(c *resty.Client, resp *resty.Response) error { r := resp.Request diff --git a/dtmsvr/config/config.go b/dtmsvr/config/config.go index ac9cf6f..b0ce9e6 100644 --- a/dtmsvr/config/config.go +++ b/dtmsvr/config/config.go @@ -30,6 +30,15 @@ type MicroService struct { OptionsJson string `yaml:"OptionsJson"` } +type HTTPMicroService struct { + Driver string `yaml:"Driver" default:"default"` + RegistryType string `yaml:"RegistryType" default:""` + RegistryAddress string `yaml:"RegistryAddress" default:""` + RegistryOptions string `yaml:"RegistryOptions" default:"{}"` + Target string `yaml:"Target"` + EndPoint string `yaml:"EndPoint"` +} + // Log config customize log type Log struct { Outputs string `yaml:"Outputs" default:"stderr"` @@ -71,19 +80,20 @@ func (s *Store) GetDBConf() dtmcli.DBConf { } type configType struct { - Store Store `yaml:"Store"` - TransCronInterval int64 `yaml:"TransCronInterval" default:"3"` - TimeoutToFail int64 `yaml:"TimeoutToFail" default:"35"` - RetryInterval int64 `yaml:"RetryInterval" default:"10"` - RequestTimeout int64 `yaml:"RequestTimeout" default:"3"` - HTTPPort int64 `yaml:"HttpPort" default:"36789"` - GrpcPort int64 `yaml:"GrpcPort" default:"36790"` - JSONRPCPort int64 `yaml:"JsonRpcPort" default:"36791"` - MicroService MicroService `yaml:"MicroService"` - UpdateBranchSync int64 `yaml:"UpdateBranchSync"` - UpdateBranchAsyncGoroutineNum int64 `yaml:"UpdateBranchAsyncGoroutineNum" default:"1"` - LogLevel string `yaml:"LogLevel" default:"info"` - Log Log `yaml:"Log"` + Store Store `yaml:"Store"` + TransCronInterval int64 `yaml:"TransCronInterval" default:"3"` + TimeoutToFail int64 `yaml:"TimeoutToFail" default:"35"` + RetryInterval int64 `yaml:"RetryInterval" default:"10"` + RequestTimeout int64 `yaml:"RequestTimeout" default:"3"` + HTTPPort int64 `yaml:"HttpPort" default:"36789"` + GrpcPort int64 `yaml:"GrpcPort" default:"36790"` + JSONRPCPort int64 `yaml:"JsonRpcPort" default:"36791"` + MicroService MicroService `yaml:"MicroService"` + HTTPMicroService HTTPMicroService `yaml:"HttpMicroService"` + UpdateBranchSync int64 `yaml:"UpdateBranchSync"` + UpdateBranchAsyncGoroutineNum int64 `yaml:"UpdateBranchAsyncGoroutineNum" default:"1"` + LogLevel string `yaml:"LogLevel" default:"info"` + Log Log `yaml:"Log"` } // Config config diff --git a/dtmsvr/svr.go b/dtmsvr/svr.go index 1a168b7..372945e 100644 --- a/dtmsvr/svr.go +++ b/dtmsvr/svr.go @@ -8,9 +8,7 @@ package dtmsvr import ( "context" - "encoding/json" "fmt" - "github.com/horseLk/dtmdriver-nacos/httpdriver" "net" "time" @@ -72,27 +70,17 @@ func StartSvr() { time.Sleep(100 * time.Millisecond) err = dtmdriver.Use(conf.MicroService.Driver) logger.FatalIfError(err) + logger.Infof("RegisterGrpcService: %s", conf.MicroService.Driver) + err = dtmdriver.GetDriver().RegisterGrpcService(conf.MicroService.Target, conf.MicroService.EndPoint) + logger.FatalIfError(err) - if v, ok := dtmdriver.GetDriver().(httpdriver.HttpDriver); ok { - logger.Infof("RegisterHttpSerrvice: %s", v) - options := make(map[string]string) - if conf.MicroService.OptionsJson == "" { - conf.MicroService.OptionsJson = "{}" - } - err = json.Unmarshal([]byte(conf.MicroService.OptionsJson), &options) - if err != nil { - logger.FatalIfError(err) - } - routesInfo := app.Routes() - paths := make([]string, 0) - for _, routeInfo := range routesInfo { - paths = append(paths, routeInfo.Path) - } - err = v.RegisterHttpService(conf.MicroService.Target, conf.MicroService.EndPoint, options) - } else { - logger.Infof("RegisterGrpcService: %s", conf.MicroService.Driver) - err = dtmdriver.GetDriver().RegisterGrpcService(conf.MicroService.Target, conf.MicroService.EndPoint) - } + err = dtmdriver.UseHTTP(conf.HTTPMicroService.Driver) + logger.FatalIfError(err) + c := &conf.HTTPMicroService + logger.Infof("RegisterHTTPService: %s", conf.HTTPMicroService.Driver) + err = dtmdriver.GetHTTPDriver().Init(c.RegistryType, c.RegistryAddress, c.RegistryOptions) + logger.FatalIfError(err) + err = dtmdriver.GetHTTPDriver().RegisterService(c.Target, c.EndPoint) logger.FatalIfError(err) } diff --git a/go.mod b/go.mod index 0268828..0295cdb 100644 --- a/go.mod +++ b/go.mod @@ -35,3 +35,7 @@ require ( gorm.io/gorm v1.22.2 // gotest.tools v2.2.0+incompatible ) + +replace github.com/dtm-labs/dtmdriver v0.0.1 => /Users/wangxi/dtm/dtmdriver + +replace github.com/horseLk/dtmdriver-nacos v1.1.0 => /Users/wangxi/dtm/dtmdriver-http-nacos From b77d623312a84f3f8bf88ae7adf092ece96cbe7e Mon Sep 17 00:00:00 2001 From: yedf2 <120050102@qq.com> Date: Fri, 15 Apr 2022 17:36:33 +0800 Subject: [PATCH 10/16] ServiceName back to dtmService --- conf.sample.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf.sample.yml b/conf.sample.yml index 8ceb79f..f3888f2 100644 --- a/conf.sample.yml +++ b/conf.sample.yml @@ -42,7 +42,7 @@ HttpMicroService: RegistryType: 'nacos' RegistryAddress: '127.0.0.1:8848,127.0.0.1:8848' RegistryOptions: '{"UserName":"nacos","Password":"nacos","NotLoadCacheAtStart":true}' - Target: '{"ServiceName":"dtm","Enable":true,"Healthy":true,"Weight":10}' + Target: '{"ServiceName":"dtmService","Enable":true,"Healthy":true,"Weight":10}' EndPoint: '127.0.0.1:36789' ### the unit of following configurations is second # TransCronInterval: 3 # the interval to poll unfinished global transaction for every dtm process From 27ba89395fa4a50b1ad6ede5c5c044510a2debc2 Mon Sep 17 00:00:00 2001 From: yedf2 <120050102@qq.com> Date: Fri, 15 Apr 2022 19:16:55 +0800 Subject: [PATCH 11/16] http microserice added to support springcloud alibaba --- conf.sample.yml | 20 +++++++++++++------- dtmsvr/trans_status.go | 5 ----- go.mod | 8 ++++---- go.sum | 4 ++++ main.go | 2 +- 5 files changed, 22 insertions(+), 17 deletions(-) diff --git a/conf.sample.yml b/conf.sample.yml index f3888f2..a6a24e9 100644 --- a/conf.sample.yml +++ b/conf.sample.yml @@ -37,13 +37,19 @@ # SuccessDataExpire: 86400 # successful Trans data will expire in 1 days. only for redis. # RedisPrefix: '{a}' # default value is '{a}'. Redis storage prefix. store data to only one slot in cluster -HttpMicroService: - Driver: 'dtm-driver-http' - RegistryType: 'nacos' - RegistryAddress: '127.0.0.1:8848,127.0.0.1:8848' - RegistryOptions: '{"UserName":"nacos","Password":"nacos","NotLoadCacheAtStart":true}' - Target: '{"ServiceName":"dtmService","Enable":true,"Healthy":true,"Weight":10}' - EndPoint: '127.0.0.1:36789' +# MicroService: # grpc based microservice config +# Driver: 'dtm-driver-gozero' # name of the driver to handle register/discover +# Target: 'etcd://localhost:2379/dtmservice' # register dtm server to this url +# EndPoint: 'localhost:36790' + +# HttpMicroService: # http based microservice config +# Driver: 'dtm-driver-http' # name of the driver to handle register/discover +# RegistryType: 'nacos' +# RegistryAddress: '127.0.0.1:8848,127.0.0.1:8848' +# RegistryOptions: '{"UserName":"nacos","Password":"nacos","NotLoadCacheAtStart":true}' +# Target: '{"ServiceName":"dtmService","Enable":true,"Healthy":true,"Weight":10}' # target and options +# EndPoint: '127.0.0.1:36789' + ### the unit of following configurations is second # TransCronInterval: 3 # the interval to poll unfinished global transaction for every dtm process # TimeoutToFail: 35 # timeout for XA, TCC to fail. saga's timeout default to infinite, which can be overwritten in saga options diff --git a/dtmsvr/trans_status.go b/dtmsvr/trans_status.go index 51f0ecd..4319976 100644 --- a/dtmsvr/trans_status.go +++ b/dtmsvr/trans_status.go @@ -9,7 +9,6 @@ package dtmsvr import ( "errors" "fmt" - "github.com/horseLk/dtmdriver-nacos/httpdriver" "net/url" "strings" "time" @@ -175,10 +174,6 @@ func (t *TransGlobal) getURLResult(uri string, branchID, op string, branchPayloa func (t *TransGlobal) getBranchResult(branch *TransBranch) (string, error) { realUrl := branch.URL - // resolver http url. - if v, ok := dtmdriver.GetDriver().(httpdriver.HttpDriver); ok { - realUrl = v.ResolveHttpService(branch.URL) - } err := t.getURLResult(realUrl, branch.BranchID, branch.Op, branch.BinData) if err == nil { return dtmcli.StatusSucceed, nil diff --git a/go.mod b/go.mod index 0295cdb..4613dc8 100644 --- a/go.mod +++ b/go.mod @@ -5,8 +5,9 @@ go 1.16 require ( bou.ke/monkey v1.0.2 github.com/BurntSushi/toml v0.4.1 // indirect - github.com/dtm-labs/dtmdriver v0.0.1 + github.com/dtm-labs/dtmdriver v0.0.2 github.com/dtm-labs/dtmdriver-gozero v0.0.2 + github.com/dtm-labs/dtmdriver-http v1.2.0 github.com/dtm-labs/dtmdriver-kratos v0.0.4 github.com/dtm-labs/dtmdriver-polaris v0.0.4 github.com/dtm-labs/dtmdriver-protocol1 v0.0.1 @@ -14,7 +15,6 @@ require ( github.com/go-redis/redis/v8 v8.11.4 github.com/go-resty/resty/v2 v2.7.0 github.com/go-sql-driver/mysql v1.6.0 - github.com/horseLk/dtmdriver-nacos v1.1.0 github.com/lib/pq v1.10.4 github.com/lithammer/shortuuid v2.0.3+incompatible github.com/lithammer/shortuuid/v3 v3.0.7 @@ -36,6 +36,6 @@ require ( // gotest.tools v2.2.0+incompatible ) -replace github.com/dtm-labs/dtmdriver v0.0.1 => /Users/wangxi/dtm/dtmdriver +// replace github.com/dtm-labs/dtmdriver v0.0.1 => /Users/wangxi/dtm/dtmdriver -replace github.com/horseLk/dtmdriver-nacos v1.1.0 => /Users/wangxi/dtm/dtmdriver-http-nacos +// replace github.com/horseLk/dtmdriver-nacos v1.1.0 => /Users/wangxi/dtm/dtmdriver-http-nacos diff --git a/go.sum b/go.sum index f01200a..d387e33 100644 --- a/go.sum +++ b/go.sum @@ -109,8 +109,12 @@ github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZ github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/dtm-labs/dtmdriver v0.0.1 h1:dHUZQ6g2ZN6eRUqds9kKq/3K7u9bcUGatUlbthD92fA= github.com/dtm-labs/dtmdriver v0.0.1/go.mod h1:fLiEeD2BPwM9Yq96TfcP9KpbTwFsn5nTxa/PP0jmFuk= +github.com/dtm-labs/dtmdriver v0.0.2 h1:h2lbxPiUe2T3RwkbO108khgUXIwZpxMw/4a2u4Df+z8= +github.com/dtm-labs/dtmdriver v0.0.2/go.mod h1:fLiEeD2BPwM9Yq96TfcP9KpbTwFsn5nTxa/PP0jmFuk= github.com/dtm-labs/dtmdriver-gozero v0.0.2 h1:T+JH9kwVNMmISPU1BNviiTrvPdMA7UMFD+nfTqGPSyA= github.com/dtm-labs/dtmdriver-gozero v0.0.2/go.mod h1:5AAKwYok5f56e0kATOXvc+DAsfu4elISDuCV+G3+fYE= +github.com/dtm-labs/dtmdriver-http v1.2.0 h1:9v1od77rSrJUuiBnZ/o6Ic4jRJpToxjP2nUOnx9CIas= +github.com/dtm-labs/dtmdriver-http v1.2.0/go.mod h1:UtWShS61TiiudZUAabQ2ww0CzSEpBYF3AS3F3G2Jc2o= github.com/dtm-labs/dtmdriver-kratos v0.0.4 h1:jDVvrwiw8GwVrampIxhoXZ9TewwQKHFpcDcQXyU2Qyc= github.com/dtm-labs/dtmdriver-kratos v0.0.4/go.mod h1:MjrFIa2A191ATVb/xy2vnA2ZKqMK9zC/1m3pjxXwkac= github.com/dtm-labs/dtmdriver-polaris v0.0.4 h1:yli0YmAsEgl47ymJHTxIzULeNe5dnmfN2ixLJRWm2Ok= diff --git a/main.go b/main.go index 44dcd71..e632169 100644 --- a/main.go +++ b/main.go @@ -21,10 +21,10 @@ import ( // load the microserver driver _ "github.com/dtm-labs/dtmdriver-gozero" + _ "github.com/dtm-labs/dtmdriver-http" _ "github.com/dtm-labs/dtmdriver-kratos" _ "github.com/dtm-labs/dtmdriver-polaris" _ "github.com/dtm-labs/dtmdriver-protocol1" - _ "github.com/horseLk/dtmdriver-nacos" ) // Version declares version info From a80e658f9606c7313cf567a90d64ed278c0a3699 Mon Sep 17 00:00:00 2001 From: yedf2 <120050102@qq.com> Date: Fri, 15 Apr 2022 19:38:01 +0800 Subject: [PATCH 12/16] fix lint warning --- dtmsvr/config/config.go | 10 +++++----- dtmsvr/trans_status.go | 3 +-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/dtmsvr/config/config.go b/dtmsvr/config/config.go index 16e76b5..0cb3aca 100644 --- a/dtmsvr/config/config.go +++ b/dtmsvr/config/config.go @@ -22,14 +22,14 @@ const ( Postgres = "postgres" ) -// MicroService config type for micro service +// MicroService config type for microservice based grpc type MicroService struct { - Driver string `yaml:"Driver" default:"default"` - Target string `yaml:"Target"` - EndPoint string `yaml:"EndPoint"` - OptionsJson string `yaml:"OptionsJson"` + Driver string `yaml:"Driver" default:"default"` + Target string `yaml:"Target"` + EndPoint string `yaml:"EndPoint"` } +// HTTPMicroService is the config type for microservice based on http, like springcloud type HTTPMicroService struct { Driver string `yaml:"Driver" default:"default"` RegistryType string `yaml:"RegistryType" default:""` diff --git a/dtmsvr/trans_status.go b/dtmsvr/trans_status.go index b5cf589..67552db 100644 --- a/dtmsvr/trans_status.go +++ b/dtmsvr/trans_status.go @@ -167,8 +167,7 @@ func (t *TransGlobal) getURLResult(uri string, branchID, op string, branchPayloa } func (t *TransGlobal) getBranchResult(branch *TransBranch) (string, error) { - realUrl := branch.URL - err := t.getURLResult(realUrl, branch.BranchID, branch.Op, branch.BinData) + err := t.getURLResult(branch.URL, branch.BranchID, branch.Op, branch.BinData) if err == nil { return dtmcli.StatusSucceed, nil } else if t.TransType == "saga" && branch.Op == dtmimp.OpAction && errors.Is(err, dtmcli.ErrFailure) { From 5f0b30953ee04886c18d5e843f4d857b1859a714 Mon Sep 17 00:00:00 2001 From: yedf2 <120050102@qq.com> Date: Fri, 15 Apr 2022 20:28:12 +0800 Subject: [PATCH 13/16] dtmdriver add log --- go.mod | 4 ++-- go.sum | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 4613dc8..958edf9 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.16 require ( bou.ke/monkey v1.0.2 github.com/BurntSushi/toml v0.4.1 // indirect - github.com/dtm-labs/dtmdriver v0.0.2 + github.com/dtm-labs/dtmdriver v0.0.3-0.20220415122659-a3e28fe58a49 github.com/dtm-labs/dtmdriver-gozero v0.0.2 github.com/dtm-labs/dtmdriver-http v1.2.0 github.com/dtm-labs/dtmdriver-kratos v0.0.4 @@ -36,6 +36,6 @@ require ( // gotest.tools v2.2.0+incompatible ) -// replace github.com/dtm-labs/dtmdriver v0.0.1 => /Users/wangxi/dtm/dtmdriver +// replace github.com/dtm-labs/dtmdriver v0.0.2 => /Users/wangxi/dtm/dtmdriver // replace github.com/horseLk/dtmdriver-nacos v1.1.0 => /Users/wangxi/dtm/dtmdriver-http-nacos diff --git a/go.sum b/go.sum index d387e33..d61187e 100644 --- a/go.sum +++ b/go.sum @@ -111,6 +111,8 @@ github.com/dtm-labs/dtmdriver v0.0.1 h1:dHUZQ6g2ZN6eRUqds9kKq/3K7u9bcUGatUlbthD9 github.com/dtm-labs/dtmdriver v0.0.1/go.mod h1:fLiEeD2BPwM9Yq96TfcP9KpbTwFsn5nTxa/PP0jmFuk= github.com/dtm-labs/dtmdriver v0.0.2 h1:h2lbxPiUe2T3RwkbO108khgUXIwZpxMw/4a2u4Df+z8= github.com/dtm-labs/dtmdriver v0.0.2/go.mod h1:fLiEeD2BPwM9Yq96TfcP9KpbTwFsn5nTxa/PP0jmFuk= +github.com/dtm-labs/dtmdriver v0.0.3-0.20220415122659-a3e28fe58a49 h1:s05hCToDnEXoSpheFJ6FbabzZUPVKSG7BXq5S22eeM4= +github.com/dtm-labs/dtmdriver v0.0.3-0.20220415122659-a3e28fe58a49/go.mod h1:fLiEeD2BPwM9Yq96TfcP9KpbTwFsn5nTxa/PP0jmFuk= github.com/dtm-labs/dtmdriver-gozero v0.0.2 h1:T+JH9kwVNMmISPU1BNviiTrvPdMA7UMFD+nfTqGPSyA= github.com/dtm-labs/dtmdriver-gozero v0.0.2/go.mod h1:5AAKwYok5f56e0kATOXvc+DAsfu4elISDuCV+G3+fYE= github.com/dtm-labs/dtmdriver-http v1.2.0 h1:9v1od77rSrJUuiBnZ/o6Ic4jRJpToxjP2nUOnx9CIas= From aaa520be98915c89f0efd61446dfaf109a753d6b Mon Sep 17 00:00:00 2001 From: yedf2 <120050102@qq.com> Date: Fri, 15 Apr 2022 20:36:53 +0800 Subject: [PATCH 14/16] update dtmdriver log --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 958edf9..f1576c0 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.16 require ( bou.ke/monkey v1.0.2 github.com/BurntSushi/toml v0.4.1 // indirect - github.com/dtm-labs/dtmdriver v0.0.3-0.20220415122659-a3e28fe58a49 + github.com/dtm-labs/dtmdriver v0.0.3-0.20220415123548-ab919250c8c4 github.com/dtm-labs/dtmdriver-gozero v0.0.2 github.com/dtm-labs/dtmdriver-http v1.2.0 github.com/dtm-labs/dtmdriver-kratos v0.0.4 diff --git a/go.sum b/go.sum index d61187e..6da15e7 100644 --- a/go.sum +++ b/go.sum @@ -113,6 +113,8 @@ github.com/dtm-labs/dtmdriver v0.0.2 h1:h2lbxPiUe2T3RwkbO108khgUXIwZpxMw/4a2u4Df github.com/dtm-labs/dtmdriver v0.0.2/go.mod h1:fLiEeD2BPwM9Yq96TfcP9KpbTwFsn5nTxa/PP0jmFuk= github.com/dtm-labs/dtmdriver v0.0.3-0.20220415122659-a3e28fe58a49 h1:s05hCToDnEXoSpheFJ6FbabzZUPVKSG7BXq5S22eeM4= github.com/dtm-labs/dtmdriver v0.0.3-0.20220415122659-a3e28fe58a49/go.mod h1:fLiEeD2BPwM9Yq96TfcP9KpbTwFsn5nTxa/PP0jmFuk= +github.com/dtm-labs/dtmdriver v0.0.3-0.20220415123548-ab919250c8c4 h1:eE9OwflZxmdc6NTL9sTgZayqQhFq/9pzqrUvqtFKpJ8= +github.com/dtm-labs/dtmdriver v0.0.3-0.20220415123548-ab919250c8c4/go.mod h1:fLiEeD2BPwM9Yq96TfcP9KpbTwFsn5nTxa/PP0jmFuk= github.com/dtm-labs/dtmdriver-gozero v0.0.2 h1:T+JH9kwVNMmISPU1BNviiTrvPdMA7UMFD+nfTqGPSyA= github.com/dtm-labs/dtmdriver-gozero v0.0.2/go.mod h1:5AAKwYok5f56e0kATOXvc+DAsfu4elISDuCV+G3+fYE= github.com/dtm-labs/dtmdriver-http v1.2.0 h1:9v1od77rSrJUuiBnZ/o6Ic4jRJpToxjP2nUOnx9CIas= From 1c222032c61e0d2dc58e765d019f8b6e274edd9d Mon Sep 17 00:00:00 2001 From: yedf2 <120050102@qq.com> Date: Fri, 15 Apr 2022 20:52:04 +0800 Subject: [PATCH 15/16] fix driver nil error --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index f1576c0..c1d8531 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.16 require ( bou.ke/monkey v1.0.2 github.com/BurntSushi/toml v0.4.1 // indirect - github.com/dtm-labs/dtmdriver v0.0.3-0.20220415123548-ab919250c8c4 + github.com/dtm-labs/dtmdriver v0.0.3 github.com/dtm-labs/dtmdriver-gozero v0.0.2 github.com/dtm-labs/dtmdriver-http v1.2.0 github.com/dtm-labs/dtmdriver-kratos v0.0.4 diff --git a/go.sum b/go.sum index 6da15e7..810d7a7 100644 --- a/go.sum +++ b/go.sum @@ -115,6 +115,8 @@ github.com/dtm-labs/dtmdriver v0.0.3-0.20220415122659-a3e28fe58a49 h1:s05hCToDnE github.com/dtm-labs/dtmdriver v0.0.3-0.20220415122659-a3e28fe58a49/go.mod h1:fLiEeD2BPwM9Yq96TfcP9KpbTwFsn5nTxa/PP0jmFuk= github.com/dtm-labs/dtmdriver v0.0.3-0.20220415123548-ab919250c8c4 h1:eE9OwflZxmdc6NTL9sTgZayqQhFq/9pzqrUvqtFKpJ8= github.com/dtm-labs/dtmdriver v0.0.3-0.20220415123548-ab919250c8c4/go.mod h1:fLiEeD2BPwM9Yq96TfcP9KpbTwFsn5nTxa/PP0jmFuk= +github.com/dtm-labs/dtmdriver v0.0.3 h1:9iAtvXKR3lJXQ7dvS87e4xdtmqkzN+ofek+CF9AvUSY= +github.com/dtm-labs/dtmdriver v0.0.3/go.mod h1:fLiEeD2BPwM9Yq96TfcP9KpbTwFsn5nTxa/PP0jmFuk= github.com/dtm-labs/dtmdriver-gozero v0.0.2 h1:T+JH9kwVNMmISPU1BNviiTrvPdMA7UMFD+nfTqGPSyA= github.com/dtm-labs/dtmdriver-gozero v0.0.2/go.mod h1:5AAKwYok5f56e0kATOXvc+DAsfu4elISDuCV+G3+fYE= github.com/dtm-labs/dtmdriver-http v1.2.0 h1:9v1od77rSrJUuiBnZ/o6Ic4jRJpToxjP2nUOnx9CIas= From 91414031bc48581edee3e066c95b55372ac2aff7 Mon Sep 17 00:00:00 2001 From: liulei Date: Sat, 16 Apr 2022 13:48:04 +0800 Subject: [PATCH 16/16] perf: dashboard component import on demand --- dashboard/package.json | 1 + dashboard/src/components.d.ts | 23 ++++++ dashboard/src/icons/readme.md | 1 + dashboard/src/main.ts | 5 -- dashboard/vite.config.ts | 8 ++ dashboard/yarn.lock | 146 ++++++++++++++++++++++++++++++---- 6 files changed, 162 insertions(+), 22 deletions(-) create mode 100644 dashboard/src/components.d.ts create mode 100644 dashboard/src/icons/readme.md diff --git a/dashboard/package.json b/dashboard/package.json index 12d2254..3a5df36 100644 --- a/dashboard/package.json +++ b/dashboard/package.json @@ -28,6 +28,7 @@ "postcss-nested": "^5.0.6", "postcss-simple-vars": "^6.0.3", "typescript": "^4.5.4", + "unplugin-vue-components": "^0.19.3", "vite": "^2.9.1", "vite-plugin-svg-icons": "^1.1.0", "vue-router": "^4.0.13", diff --git a/dashboard/src/components.d.ts b/dashboard/src/components.d.ts new file mode 100644 index 0000000..ff00510 --- /dev/null +++ b/dashboard/src/components.d.ts @@ -0,0 +1,23 @@ +// generated by unplugin-vue-components +// We suggest you to commit this file into source control +// Read more: https://github.com/vuejs/vue-next/pull/3399 +import '@vue/runtime-core' + +declare module '@vue/runtime-core' { + export interface GlobalComponents { + ABreadcrumb: typeof import('ant-design-vue/es')['Breadcrumb'] + ABreadcrumbItem: typeof import('ant-design-vue/es')['BreadcrumbItem'] + ALayout: typeof import('ant-design-vue/es')['Layout'] + ALayoutContent: typeof import('ant-design-vue/es')['LayoutContent'] + ALayoutHeader: typeof import('ant-design-vue/es')['LayoutHeader'] + ALayoutSider: typeof import('ant-design-vue/es')['LayoutSider'] + AMenu: typeof import('ant-design-vue/es')['Menu'] + AMenuItem: typeof import('ant-design-vue/es')['MenuItem'] + ASubMenu: typeof import('ant-design-vue/es')['SubMenu'] + RouterLink: typeof import('vue-router')['RouterLink'] + RouterView: typeof import('vue-router')['RouterView'] + SvgIcon: typeof import('./components/SvgIcon/index.vue')['default'] + } +} + +export {} diff --git a/dashboard/src/icons/readme.md b/dashboard/src/icons/readme.md new file mode 100644 index 0000000..2d5774e --- /dev/null +++ b/dashboard/src/icons/readme.md @@ -0,0 +1 @@ +# ICon Component diff --git a/dashboard/src/main.ts b/dashboard/src/main.ts index bea84b0..87b914e 100644 --- a/dashboard/src/main.ts +++ b/dashboard/src/main.ts @@ -4,14 +4,9 @@ import router from '/@/router/index' import { pinia } from '/@/store' import '/@/permission' -import Antd from 'ant-design-vue' -import 'ant-design-vue/dist/antd.css' import 'virtual:svg-icons-register' -import SvgIcon from '/@/components/SvgIcon/index.vue' const app = createApp(App) -app.use(Antd) app.use(router) app.use(pinia) -app.component('SvgIcon', SvgIcon) app.mount('#app') diff --git a/dashboard/vite.config.ts b/dashboard/vite.config.ts index 504a891..52e07cf 100644 --- a/dashboard/vite.config.ts +++ b/dashboard/vite.config.ts @@ -2,6 +2,8 @@ import { ConfigEnv, UserConfigExport } from 'vite'; import path from 'path'; import vue from '@vitejs/plugin-vue'; import viteSvgIcons from 'vite-plugin-svg-icons'; +import Components from 'unplugin-vue-components/vite'; +import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers' const setAlias = (alias: [string, string][]) => alias.map((v) => { return { find: v[0], replacement: path.resolve(__dirname, v[1]) }; @@ -17,6 +19,12 @@ export default ({ }: ConfigEnv): UserConfigExport => { viteSvgIcons({ iconDirs: [path.resolve(process.cwd(), 'src/icons')], symbolId: 'icon-[dir]-[name]' + }), + Components({ + dts: 'src/components.d.ts', + resolvers: [ + AntDesignVueResolver() + ] }) ], server: { diff --git a/dashboard/yarn.lock b/dashboard/yarn.lock index 4303235..a5ec549 100644 --- a/dashboard/yarn.lock +++ b/dashboard/yarn.lock @@ -22,6 +22,11 @@ "@ant-design/colors" "^6.0.0" "@ant-design/icons-svg" "^4.2.1" +"@antfu/utils@^0.5.0": + version "0.5.1" + resolved "https://registry.npmmirror.com/@antfu/utils/-/utils-0.5.1.tgz#7eb6764878adb715daff20019e5a15fd63d93342" + integrity sha512-8Afo0+xvYe1K8Wm4xHTymfTkpzy36aaqDvhXIayUwl+mecMG9Xzl3XjXa6swG6Bk8FBeQ646RyvmsYt6+2Be9g== + "@babel/helper-validator-identifier@^7.16.7": version "7.16.7" resolved "https://registry.npmmirror.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz" @@ -121,6 +126,14 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" +"@rollup/pluginutils@^4.2.0": + version "4.2.1" + resolved "https://registry.npmmirror.com/@rollup/pluginutils/-/pluginutils-4.2.1.tgz#e6c6c3aba0744edce3fb2074922d3776c0af2a6d" + integrity sha512-iKnFXr7NkdZAIHiIWE+BX5ULi/ucVFYWD6TbAV+rZctiRTY2PL6tsIKhoIOaoskiWAkgu+VsbXgUVDNLHf+InQ== + dependencies: + estree-walker "^2.0.1" + picomatch "^2.2.2" + "@simonwep/pickr@~1.8.0": version "1.8.2" resolved "https://registry.npmmirror.com/@simonwep/pickr/-/pickr-1.8.2.tgz" @@ -473,6 +486,14 @@ ant-design-vue@^3.1.1: vue-types "^3.0.0" warning "^4.0.0" +anymatch@~3.1.2: + version "3.1.2" + resolved "https://registry.npmmirror.com/anymatch/-/anymatch-3.1.2.tgz#c0557c096af32f106198f4f4e2a383537e378716" + integrity sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg== + dependencies: + normalize-path "^3.0.0" + picomatch "^2.0.4" + argparse@^2.0.1: version "2.0.1" resolved "https://registry.npmmirror.com/argparse/-/argparse-2.0.1.tgz" @@ -582,6 +603,11 @@ big.js@^5.2.2: resolved "https://registry.npmmirror.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328" integrity sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ== +binary-extensions@^2.0.0: + version "2.2.0" + resolved "https://registry.npmmirror.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" + integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== + bluebird@^3.5.0: version "3.7.2" resolved "https://registry.npmmirror.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" @@ -600,6 +626,13 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" +brace-expansion@^2.0.1: + version "2.0.1" + resolved "https://registry.npmmirror.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" + integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA== + dependencies: + balanced-match "^1.0.0" + braces@^2.2.2: version "2.3.2" resolved "https://registry.npmmirror.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" @@ -616,7 +649,7 @@ braces@^2.2.2: split-string "^3.0.2" to-regex "^3.0.1" -braces@^3.0.2: +braces@^3.0.2, braces@~3.0.2: version "3.0.2" resolved "https://registry.npmmirror.com/braces/-/braces-3.0.2.tgz" integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== @@ -693,6 +726,21 @@ character-parser@^2.2.0: dependencies: is-regex "^1.0.3" +chokidar@^3.5.3: + version "3.5.3" + resolved "https://registry.npmmirror.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" + integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw== + dependencies: + anymatch "~3.1.2" + braces "~3.0.2" + glob-parent "~5.1.2" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.6.0" + optionalDependencies: + fsevents "~2.3.2" + class-utils@^0.3.5: version "0.3.6" resolved "https://registry.npmmirror.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" @@ -836,7 +884,7 @@ debug@^2.2.0, debug@^2.3.3: dependencies: ms "2.0.0" -debug@^4.1.1, debug@^4.3.2, debug@^4.3.3: +debug@^4.1.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4: version "4.3.4" resolved "https://registry.npmmirror.com/debug/-/debug-4.3.4.tgz" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== @@ -1253,7 +1301,7 @@ estraverse@^5.1.0, estraverse@^5.2.0: resolved "https://registry.npmmirror.com/estraverse/-/estraverse-5.3.0.tgz" integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== -estree-walker@^2.0.2: +estree-walker@^2.0.1, estree-walker@^2.0.2: version "2.0.2" resolved "https://registry.npmmirror.com/estree-walker/-/estree-walker-2.0.2.tgz" integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w== @@ -1315,7 +1363,7 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: resolved "https://registry.npmmirror.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== -fast-glob@^3.2.9: +fast-glob@^3.2.11, fast-glob@^3.2.9: version "3.2.11" resolved "https://registry.npmmirror.com/fast-glob/-/fast-glob-3.2.11.tgz" integrity sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew== @@ -1445,7 +1493,7 @@ get-value@^2.0.3, get-value@^2.0.6: resolved "https://registry.npmmirror.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" integrity sha512-Ln0UQDlxH1BapMu3GPtf7CuYNwRZf2gwCuPqbyG6pB8WfmFpzqcy4xtAaAMUhnNqjMKTiCPZG2oMT3YSx8U2NA== -glob-parent@^5.1.2: +glob-parent@^5.1.2, glob-parent@~5.1.2: version "5.1.2" resolved "https://registry.npmmirror.com/glob-parent/-/glob-parent-5.1.2.tgz" integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== @@ -1639,6 +1687,13 @@ is-accessor-descriptor@^1.0.0: dependencies: kind-of "^6.0.0" +is-binary-path@~2.1.0: + version "2.1.0" + resolved "https://registry.npmmirror.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" + integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== + dependencies: + binary-extensions "^2.0.0" + is-buffer@^1.1.5: version "1.1.6" resolved "https://registry.npmmirror.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" @@ -1708,7 +1763,7 @@ is-extglob@^2.1.1: resolved "https://registry.npmmirror.com/is-extglob/-/is-extglob-2.1.1.tgz" integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== -is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3: +is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: version "4.0.3" resolved "https://registry.npmmirror.com/is-glob/-/is-glob-4.0.3.tgz" integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== @@ -1891,6 +1946,11 @@ loader-utils@^1.1.0: emojis-list "^3.0.0" json5 "^1.0.1" +local-pkg@^0.4.1: + version "0.4.1" + resolved "https://registry.npmmirror.com/local-pkg/-/local-pkg-0.4.1.tgz#e7b0d7aa0b9c498a1110a5ac5b00ba66ef38cfff" + integrity sha512-lL87ytIGP2FU5PWwNDo0w3WhIo2gopIAxPg9RxDYF7m4rr5ahuZxP22xnJHIvaLTe4Z9P6uKKY2UHiwyB4pcrw== + lodash-es@^4.17.15: version "4.17.21" resolved "https://registry.npmmirror.com/lodash-es/-/lodash-es-4.17.21.tgz" @@ -1925,6 +1985,13 @@ magic-string@^0.25.7: dependencies: sourcemap-codec "^1.4.8" +magic-string@^0.26.1: + version "0.26.1" + resolved "https://registry.npmmirror.com/magic-string/-/magic-string-0.26.1.tgz#ba9b651354fa9512474199acecf9c6dbe93f97fd" + integrity sha512-ndThHmvgtieXe8J/VGPjG+Apu7v7ItcD5mhEIvOscWjPF/ccOiLxHaSuCAS2G+3x4GKsAbT8u7zdyamupui8Tg== + dependencies: + sourcemap-codec "^1.4.8" + map-cache@^0.2.2: version "0.2.2" resolved "https://registry.npmmirror.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" @@ -1988,6 +2055,13 @@ minimatch@^3.0.4: dependencies: brace-expansion "^1.1.7" +minimatch@^5.0.1: + version "5.0.1" + resolved "https://registry.npmmirror.com/minimatch/-/minimatch-5.0.1.tgz#fb9022f7528125187c92bd9e9b6366be1cf3415b" + integrity sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g== + dependencies: + brace-expansion "^2.0.1" + minimist@^1.2.0: version "1.2.6" resolved "https://registry.npmmirror.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44" @@ -2048,6 +2122,11 @@ node-releases@^2.0.2: resolved "https://registry.npmmirror.com/node-releases/-/node-releases-2.0.2.tgz#7139fe71e2f4f11b47d4d2986aaf8c48699e0c01" integrity sha512-XxYDdcQ6eKqp/YjI+tb2C5WM2LgjnZrfYg4vgQt49EK268b6gYCHsBLrK2qvJo4FmCtqmKezb0WZFK4fkrZNsg== +normalize-path@^3.0.0, normalize-path@~3.0.0: + version "3.0.0" + resolved "https://registry.npmmirror.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" + integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== + normalize-range@^0.1.2: version "0.1.2" resolved "https://registry.npmmirror.com/normalize-range/-/normalize-range-0.1.2.tgz#2d10c06bdfd312ea9777695a4d28439456b75942" @@ -2149,7 +2228,7 @@ picocolors@^1.0.0: resolved "https://registry.npmmirror.com/picocolors/-/picocolors-1.0.0.tgz" integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== -picomatch@^2.3.1: +picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.2, picomatch@^2.3.1: version "2.3.1" resolved "https://registry.npmmirror.com/picomatch/-/picomatch-2.3.1.tgz" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== @@ -2221,7 +2300,7 @@ postcss@^5.2.17: source-map "^0.5.6" supports-color "^3.2.3" -postcss@^8.1.10: +postcss@^8.1.10, postcss@^8.4.12: version "8.4.12" resolved "https://registry.npmmirror.com/postcss/-/postcss-8.4.12.tgz" integrity sha512-lg6eITwYe9v6Hr5CncVbK70SoioNQIq81nsaG86ev5hAidQvmOeETBqs7jm43K2F5/Ley3ytDtriImV6TpNiSg== @@ -2230,15 +2309,6 @@ postcss@^8.1.10: picocolors "^1.0.0" source-map-js "^1.0.2" -postcss@^8.4.12: - version "8.4.12" - resolved "https://registry.npmjs.org/postcss/-/postcss-8.4.12.tgz#1e7de78733b28970fa4743f7da6f3763648b1905" - integrity sha512-lg6eITwYe9v6Hr5CncVbK70SoioNQIq81nsaG86ev5hAidQvmOeETBqs7jm43K2F5/Ley3ytDtriImV6TpNiSg== - dependencies: - nanoid "^3.3.1" - picocolors "^1.0.0" - source-map-js "^1.0.2" - posthtml-parser@^0.2.0, posthtml-parser@^0.2.1: version "0.2.1" resolved "https://registry.npmmirror.com/posthtml-parser/-/posthtml-parser-0.2.1.tgz#35d530de386740c2ba24ff2eb2faf39ccdf271dd" @@ -2426,6 +2496,13 @@ readable-stream@^3.1.1: string_decoder "^1.1.1" util-deprecate "^1.0.1" +readdirp@~3.6.0: + version "3.6.0" + resolved "https://registry.npmmirror.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" + integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA== + dependencies: + picomatch "^2.2.1" + regenerator-runtime@^0.13.4: version "0.13.9" resolved "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz" @@ -2841,6 +2918,31 @@ universalify@^2.0.0: resolved "https://registry.npmmirror.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717" integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ== +unplugin-vue-components@^0.19.3: + version "0.19.3" + resolved "https://registry.npmmirror.com/unplugin-vue-components/-/unplugin-vue-components-0.19.3.tgz#4c0aa419d118aee1c010d0da9d38ead45e735d63" + integrity sha512-z/kpYJnqrJuWglDNs7fy0YRHr41oLc07y2TkP3by6DqPb1GG9xGC9SFigeFwd4J7GVTqyFVsnjoeup7uK7I2dA== + dependencies: + "@antfu/utils" "^0.5.0" + "@rollup/pluginutils" "^4.2.0" + chokidar "^3.5.3" + debug "^4.3.4" + fast-glob "^3.2.11" + local-pkg "^0.4.1" + magic-string "^0.26.1" + minimatch "^5.0.1" + resolve "^1.22.0" + unplugin "^0.6.1" + +unplugin@^0.6.1: + version "0.6.2" + resolved "https://registry.npmmirror.com/unplugin/-/unplugin-0.6.2.tgz#5646829e7f8a664c8a4498654f258dc6ad3ebf1f" + integrity sha512-+QONc2uBFQbeo4x5mlJHjTKjR6pmuchMpGVrWhwdGFFMb4ttFZ4E9KqhOOrNcm3Q8NNyB1vJ4s5e36IZC7UWYw== + dependencies: + chokidar "^3.5.3" + webpack-sources "^3.2.3" + webpack-virtual-modules "^0.4.3" + unset-value@^1.0.0: version "1.0.0" resolved "https://registry.npmmirror.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" @@ -3103,6 +3205,16 @@ warning@^4.0.0: dependencies: loose-envify "^1.0.0" +webpack-sources@^3.2.3: + version "3.2.3" + resolved "https://registry.npmmirror.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde" + integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w== + +webpack-virtual-modules@^0.4.3: + version "0.4.3" + resolved "https://registry.npmmirror.com/webpack-virtual-modules/-/webpack-virtual-modules-0.4.3.tgz#cd597c6d51d5a5ecb473eea1983a58fa8a17ded9" + integrity sha512-5NUqC2JquIL2pBAAo/VfBP6KuGkHIZQXW/lNKupLPfhViwh8wNsu0BObtl09yuKZszeEUfbXz8xhrHvSG16Nqw== + which@^2.0.1: version "2.0.2" resolved "https://registry.npmmirror.com/which/-/which-2.0.2.tgz"