From 2df8040642992ccfef41ab033894e89f7ec75b86 Mon Sep 17 00:00:00 2001 From: KuiLiao Date: Wed, 6 Apr 2022 00:21:47 +0800 Subject: [PATCH 01/15] 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/15] 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/15] 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/15] 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/15] 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/15] 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/15] 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/15] 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/15] 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/15] 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/15] 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/15] 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/15] 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/15] 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/15] 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=