From 8f6a1327f727798c1347a776e7cd7c297930f43f Mon Sep 17 00:00:00 2001 From: devad Date: Thu, 17 Aug 2023 18:04:19 +0800 Subject: [PATCH] :recycle: Add redis impl Signed-off-by: devad Former-commit-id: 4e2048744663e82a43a82aea9df5b54dfb862bd1 --- go.mod | 35 +- go.sum | 64 ++-- rpc/Makefile | 3 +- .../participantservice/participantservice.go | 6 +- rpc/client/pcmcore/pcmcore.go | 2 + rpc/internal/logic/cronlogic.go | 5 - .../participantservice/heartbeatcheck.go | 66 ---- .../listparticipantlogic.go | 36 ++- .../reportheartbeatlogic.go | 23 +- .../participantserviceserver.go | 2 +- rpc/internal/svc/servicecontext.go | 2 +- rpc/pb/pcmCore.proto | 13 +- rpc/pcmCore/pcmCore.pb.go | 299 ++++++++++++++---- rpc/pcmCore/pcmCore_grpc.pb.go | 10 +- 14 files changed, 360 insertions(+), 206 deletions(-) delete mode 100644 rpc/internal/logic/participantservice/heartbeatcheck.go diff --git a/go.mod b/go.mod index 0149e1ea..4bba8334 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,10 @@ module gitlink.org.cn/jcce-pcm/pcm-coordinator -go 1.18 +go 1.19 require ( github.com/Masterminds/squirrel v1.5.4 - github.com/aws/aws-sdk-go v1.44.322 + github.com/aws/aws-sdk-go v1.44.325 github.com/docker/docker v24.0.5+incompatible github.com/go-redis/redis v6.15.9+incompatible github.com/go-redis/redis/v8 v8.11.5 @@ -14,9 +14,14 @@ require ( github.com/robfig/cron/v3 v3.0.1 github.com/shopspring/decimal v1.3.1 github.com/zeromicro/go-queue v1.1.8 - github.com/zeromicro/go-zero v1.5.3 - gitlink.org.cn/jcce-pcm/utils v0.0.0-20230814014928-a705f3bb3eae - google.golang.org/grpc v1.56.2 + github.com/zeromicro/go-zero v1.5.4 + gitlink.org.cn/jcce-pcm/pcm-participant-ac v0.0.0-20230814074259-99e24e1194d1 + gitlink.org.cn/jcce-pcm/pcm-participant-ceph v0.0.0-20230811110436-43ae93ec1796 + gitlink.org.cn/jcce-pcm/pcm-participant-modelarts v0.0.0-20230719015658-08a29549d86a + gitlink.org.cn/jcce-pcm/pcm-participant-octopus v0.0.0-20230714030856-601935bc30e2 + gitlink.org.cn/jcce-pcm/pcm-participant-slurm v0.0.0-20230714030125-a52fa198ddf4 + gitlink.org.cn/jcce-pcm/utils v0.0.2 + google.golang.org/grpc v1.57.0 google.golang.org/protobuf v1.31.0 gorm.io/driver/mysql v1.5.1 gorm.io/gorm v1.25.3 @@ -78,12 +83,12 @@ require ( github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.0.2 // indirect github.com/openzipkin/zipkin-go v0.4.1 // indirect - github.com/pelletier/go-toml/v2 v2.0.8 // indirect + github.com/pelletier/go-toml/v2 v2.0.9 // indirect github.com/pierrec/lz4/v4 v4.1.17 // indirect - github.com/prometheus/client_golang v1.15.1 // indirect + github.com/prometheus/client_golang v1.16.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.42.0 // indirect - github.com/prometheus/procfs v0.9.0 // indirect + github.com/prometheus/procfs v0.10.1 // indirect github.com/segmentio/kafka-go v0.4.38 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect go.etcd.io/etcd/api/v3 v3.5.9 // indirect @@ -105,16 +110,18 @@ require ( go.uber.org/multierr v1.9.0 // indirect go.uber.org/zap v1.24.0 // indirect golang.org/x/mod v0.9.0 // indirect - golang.org/x/net v0.10.0 // indirect + golang.org/x/net v0.12.0 // indirect golang.org/x/oauth2 v0.7.0 // indirect - golang.org/x/sync v0.1.0 // indirect - golang.org/x/sys v0.8.0 // indirect - golang.org/x/term v0.8.0 // indirect - golang.org/x/text v0.9.0 // indirect + golang.org/x/sync v0.2.0 // indirect + golang.org/x/sys v0.10.0 // indirect + golang.org/x/term v0.10.0 // indirect + golang.org/x/text v0.11.0 // indirect golang.org/x/time v0.3.0 // indirect golang.org/x/tools v0.7.0 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect + google.golang.org/genproto v0.0.0-20230526161137-0005af68ea54 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230525234035-dd9d682886f9 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/ini.v1 v1.66.2 // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect diff --git a/go.sum b/go.sum index 0071e6fd..fc6347f8 100644 --- a/go.sum +++ b/go.sum @@ -425,14 +425,14 @@ github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a h1:HbKu58rmZp github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= github.com/alicebob/miniredis/v2 v2.23.1/go.mod h1:84TWKZlxYkfgMucPBf5SOQBYJceZeQRFIaQgNMiCX6Q= github.com/alicebob/miniredis/v2 v2.30.1/go.mod h1:b25qWj4fCEsBeAAR2mlb0ufImGC6uH3VlUfb/HS5zKg= -github.com/alicebob/miniredis/v2 v2.30.3 h1:hrqDB4cHFSHQf4gO3xu6YKQg8PqJpNjLYsQAFYHstqw= +github.com/alicebob/miniredis/v2 v2.30.4 h1:8S4/o1/KoUArAGbGwPxcwf0krlzceva2XVOSchFS7Eo= github.com/aliyun/alibaba-cloud-sdk-go v1.61.1704 h1:PpfENOj/vPfhhy9N2OFRjpue0hjM5XqAp2thFmkXXIk= github.com/aliyun/alibaba-cloud-sdk-go v1.61.1704/go.mod h1:RcDobYh8k5VP6TNybz9m++gL3ijVI5wueVr0EM10VsU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= -github.com/aws/aws-sdk-go v1.44.322 h1:7JfwifGRGQMHd99PvfXqxBaZsjuRaOF6e3X9zRx2uYo= -github.com/aws/aws-sdk-go v1.44.322/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/aws/aws-sdk-go v1.44.325 h1:jF/L99fJSq/BfiLmUOflO/aM+LwcqBm0Fe/qTK5xxuI= +github.com/aws/aws-sdk-go v1.44.325/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/beanstalkd/go-beanstalk v0.2.0/go.mod h1:/G8YTyChOtpOArwLTQPY1CHB+i212+av35bkPXXj56Y= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= @@ -887,8 +887,8 @@ github.com/paulmach/orb v0.5.0/go.mod h1:FWRlTgl88VI1RBx/MkrwWDRhQ96ctqMCh8boXhm github.com/paulmach/protoscan v0.2.1/go.mod h1:SpcSwydNLrxUGSDvXvO0P7g7AuhJ7lcKfDlhJCDw2gY= github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= github.com/pelletier/go-toml/v2 v2.0.7/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= -github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ= -github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4= +github.com/pelletier/go-toml/v2 v2.0.9 h1:uH2qQXheeefCCkuBBSLi7jCiSmj3VRh2+Goq2N7Xxu0= +github.com/pelletier/go-toml/v2 v2.0.9/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= @@ -916,8 +916,8 @@ github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrb github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= github.com/prometheus/client_golang v1.13.0/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= -github.com/prometheus/client_golang v1.15.1 h1:8tXpTmJbyH5lydzFPoxSIJ0J46jdh3tylbvM1xCv0LI= -github.com/prometheus/client_golang v1.15.1/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk= +github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8= +github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -937,8 +937,8 @@ github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= -github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= -github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= +github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= +github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= github.com/rabbitmq/amqp091-go v1.1.0/go.mod h1:ogQDLSOACsLPsIq0NpbtiifNZi2YOz0VTJ0kHRghqbM= github.com/rabbitmq/amqp091-go v1.5.0/go.mod h1:JsV0ofX5f1nwOGafb8L5rBItt9GyhfQfcJj+oyz0dGg= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= @@ -993,8 +993,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk= github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hMwiKKqXCQ= @@ -1025,10 +1025,10 @@ github.com/zeromicro/go-queue v1.1.8 h1:DSzOYh6tSr0Flw9FqnaBX2fxR0T3vgEwVNItobLw github.com/zeromicro/go-queue v1.1.8/go.mod h1:sKF0fI9cKmqY/Y9Pr2aRnt3zllnPglBJ1yl4ByOEhiw= github.com/zeromicro/go-zero v1.4.3/go.mod h1:UmDjuW7LHd9j7+nnnPBcXF0HLNmjJw6OjHPTlSp7X7Y= github.com/zeromicro/go-zero v1.5.1/go.mod h1:bGYm4XWsGN9GhDsO2O2BngpVoWjf3Eog2a5hUOMhlXs= -github.com/zeromicro/go-zero v1.5.3 h1:9poyd+raeL7gSMUu6P19N7bssTppieR2j7Oos2j1yFQ= -github.com/zeromicro/go-zero v1.5.3/go.mod h1:dmoBpgJTxt9KWmgrNGpv06XxZRPXMakrxUVgROFAR3g= -gitlink.org.cn/jcce-pcm/pcm-participant-ac v0.0.0-20230719012340-05049e43b869 h1:P0k0QqANY+Odhihyo4IZvhm4dd0a8BTlyaHiLHDKKyM= -gitlink.org.cn/jcce-pcm/pcm-participant-ac v0.0.0-20230719012340-05049e43b869/go.mod h1:fpj6MlFgDoGv5R0ETSg+Mni4VoykKXNrvNJAOkV9cvU= +github.com/zeromicro/go-zero v1.5.4 h1:kRvcYuxcHOkUZvg7887KQl77Qv4klGL7MqGkTBgkpS8= +github.com/zeromicro/go-zero v1.5.4/go.mod h1:x/aUyLmSwRECvOyjOf+lhwThBOilJIY+s3slmPAeboA= +gitlink.org.cn/jcce-pcm/pcm-participant-ac v0.0.0-20230814074259-99e24e1194d1 h1:eh5H8d2+YsvN6uhkwMg6UbihPEDZcU2yKpXVYE8hDE0= +gitlink.org.cn/jcce-pcm/pcm-participant-ac v0.0.0-20230814074259-99e24e1194d1/go.mod h1:OflOWySJqYAygcwL7vT2yVtfcUs9TM3kmoD+89Tbu7c= gitlink.org.cn/jcce-pcm/pcm-participant-ceph v0.0.0-20230811110436-43ae93ec1796 h1:NxIT12DfQW3ff8fUwrEhHFwe/c9sIlxUG3g0XUh7v90= gitlink.org.cn/jcce-pcm/pcm-participant-ceph v0.0.0-20230811110436-43ae93ec1796/go.mod h1:Jk4srb1NAFSn/kMWeo71/I02luZ8OrmVnUFWb8abr7I= gitlink.org.cn/jcce-pcm/pcm-participant-modelarts v0.0.0-20230719015658-08a29549d86a h1:eSniMdLizPV3RNrz7/URgjT3Kpv1cTZ05jrWfxRJxHs= @@ -1037,10 +1037,6 @@ gitlink.org.cn/jcce-pcm/pcm-participant-octopus v0.0.0-20230714030856-601935bc30 gitlink.org.cn/jcce-pcm/pcm-participant-octopus v0.0.0-20230714030856-601935bc30e2/go.mod h1:uyvpVqG1jHDXX+ubXI0RBwnWXzVykD/mliqGQIDvRoo= gitlink.org.cn/jcce-pcm/pcm-participant-slurm v0.0.0-20230714030125-a52fa198ddf4 h1:r2hBP5G/bbkPpDTPk3ENnQxD82vkoYMSeNHYhNAVRX4= gitlink.org.cn/jcce-pcm/pcm-participant-slurm v0.0.0-20230714030125-a52fa198ddf4/go.mod h1:zRdVJiv4r4jgBli2xpYGmV0n6Gmz8fkZ5pJaNK2MbTU= -gitlink.org.cn/jcce-pcm/utils v0.0.0-20230814014928-a705f3bb3eae h1:oJxnyOJ6Ps/uPqwSEumXcUYm7dkF08r4gHhfy7NRn4s= -gitlink.org.cn/jcce-pcm/utils v0.0.0-20230814014928-a705f3bb3eae/go.mod h1:zTa+selMe02jZ3u6Ij1rTF2CrGd2ZqzqyMQ/FwhdpvY= -gitlink.org.cn/jcce-pcm/utils v0.0.1 h1:3PH93Z/JFTH5JRO9MFf3dD1Gnd12aGiIIViWBlQGuhE= -gitlink.org.cn/jcce-pcm/utils v0.0.1/go.mod h1:5cwaaqM0+HK5GXVbYozGlWvgwoUby0KytdvhbwQW1ks= gitlink.org.cn/jcce-pcm/utils v0.0.2 h1:Stif8W9C9TOCS2hw4g+OlOywDrsVYNrkiyKfBrWkT0w= gitlink.org.cn/jcce-pcm/utils v0.0.2/go.mod h1:u8PTlBpzUyOlbQJgfSiutq91q/JtrJIQiPNDe4S/pGs= go.etcd.io/etcd/api/v3 v3.5.5/go.mod h1:KFtNaxGDw4Yx/BA4iPPwevUTAuqcsPxzyX8PHydchN8= @@ -1137,8 +1133,8 @@ golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20221010152910-d6f0a8c073c2/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= +golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1255,8 +1251,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= +golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1301,8 +1297,9 @@ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220923202941-7f9b1623fab7/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= +golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1404,8 +1401,8 @@ golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -1418,8 +1415,8 @@ golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= -golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c= +golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1435,8 +1432,9 @@ golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= +golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1693,8 +1691,12 @@ google.golang.org/genproto v0.0.0-20221202195650-67e5cbc046fd/go.mod h1:cTsE614G google.golang.org/genproto v0.0.0-20221207170731-23e4bf6bdc37/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= google.golang.org/genproto v0.0.0-20230123190316-2c411cf9d197/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= +google.golang.org/genproto v0.0.0-20230526161137-0005af68ea54 h1:9NWlQfY2ePejTmfwUH1OWwmznFa+0kKcHGPDvcPza9M= +google.golang.org/genproto v0.0.0-20230526161137-0005af68ea54/go.mod h1:zqTuNwFlFRsw5zIts5VnzLQxSRqh+CGOTVMlYbY0Eyk= +google.golang.org/genproto/googleapis/api v0.0.0-20230525234035-dd9d682886f9 h1:m8v1xLLLzMe1m5P+gCTF8nJB9epwZQUBERm20Oy1poQ= +google.golang.org/genproto/googleapis/api v0.0.0-20230525234035-dd9d682886f9/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 h1:0nDDozoAU19Qb2HwhXadU8OcsiO/09cnTqhUtq2MEOM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -1735,8 +1737,8 @@ google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCD google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= -google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI= -google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= +google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= diff --git a/rpc/Makefile b/rpc/Makefile index eec8ebd1..2abe2b81 100644 --- a/rpc/Makefile +++ b/rpc/Makefile @@ -2,4 +2,5 @@ pcm-core-rpc: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o pcm-core-rpc adaptor/PCM-CORE/rpc/pcmcore.go rpc-gen: - goctl rpc protoc pb/*.proto --go_out=. --go-grpc_out=. --zrpc_out=. -m \ No newline at end of file + goctl rpc protoc pb/*.proto --go_out=. --go-grpc_out=. --zrpc_out=. -m + protoc-go-inject-tag -input="pcmCore/*.pb.go" -remove_tag_comment \ No newline at end of file diff --git a/rpc/client/participantservice/participantservice.go b/rpc/client/participantservice/participantservice.go index 5fd66264..0bf052ca 100644 --- a/rpc/client/participantservice/participantservice.go +++ b/rpc/client/participantservice/participantservice.go @@ -14,6 +14,7 @@ import ( type ( AiInfo = pcmCore.AiInfo + ClientInfo = pcmCore.ClientInfo CloudInfo = pcmCore.CloudInfo HealthCheckResp = pcmCore.HealthCheckResp HpcInfo = pcmCore.HpcInfo @@ -29,6 +30,7 @@ type ( ParticipantPhyReq = pcmCore.ParticipantPhyReq ParticipantPhyResp = pcmCore.ParticipantPhyResp ParticipantResp = pcmCore.ParticipantResp + ParticipantServiceResp = pcmCore.ParticipantServiceResp ParticipantTenant = pcmCore.ParticipantTenant SyncInfoReq = pcmCore.SyncInfoReq SyncInfoResp = pcmCore.SyncInfoResp @@ -41,7 +43,7 @@ type ( // reportAvailable 监控数据上报 ReportAvailable(ctx context.Context, in *ParticipantAvailReq, opts ...grpc.CallOption) (*ParticipantResp, error) // listParticipant 服务列表 - ListParticipant(ctx context.Context, in *ParticipantTenant, opts ...grpc.CallOption) (*ParticipantResp, error) + ListParticipant(ctx context.Context, in *ParticipantTenant, opts ...grpc.CallOption) (*ParticipantServiceResp, error) // listAvailable 集群动态信息列表 ListPhyAvailable(ctx context.Context, in *ParticipantTenant, opts ...grpc.CallOption) (*ListParticipantAvailResp, error) // listPhyInformation 集群静态信息列表 @@ -78,7 +80,7 @@ func (m *defaultParticipantService) ReportAvailable(ctx context.Context, in *Par } // listParticipant 服务列表 -func (m *defaultParticipantService) ListParticipant(ctx context.Context, in *ParticipantTenant, opts ...grpc.CallOption) (*ParticipantResp, error) { +func (m *defaultParticipantService) ListParticipant(ctx context.Context, in *ParticipantTenant, opts ...grpc.CallOption) (*ParticipantServiceResp, error) { client := pcmCore.NewParticipantServiceClient(m.cli.Conn()) return client.ListParticipant(ctx, in, opts...) } diff --git a/rpc/client/pcmcore/pcmcore.go b/rpc/client/pcmcore/pcmcore.go index 2ca6e3b0..40caca8b 100644 --- a/rpc/client/pcmcore/pcmcore.go +++ b/rpc/client/pcmcore/pcmcore.go @@ -14,6 +14,7 @@ import ( type ( AiInfo = pcmCore.AiInfo + ClientInfo = pcmCore.ClientInfo CloudInfo = pcmCore.CloudInfo HealthCheckResp = pcmCore.HealthCheckResp HpcInfo = pcmCore.HpcInfo @@ -29,6 +30,7 @@ type ( ParticipantPhyReq = pcmCore.ParticipantPhyReq ParticipantPhyResp = pcmCore.ParticipantPhyResp ParticipantResp = pcmCore.ParticipantResp + ParticipantServiceResp = pcmCore.ParticipantServiceResp ParticipantTenant = pcmCore.ParticipantTenant SyncInfoReq = pcmCore.SyncInfoReq SyncInfoResp = pcmCore.SyncInfoResp diff --git a/rpc/internal/logic/cronlogic.go b/rpc/internal/logic/cronlogic.go index 5e66af96..0225683a 100644 --- a/rpc/internal/logic/cronlogic.go +++ b/rpc/internal/logic/cronlogic.go @@ -3,7 +3,6 @@ package logic import ( "github.com/zeromicro/go-zero/core/logx" "gitlink.org.cn/jcce-pcm/pcm-coordinator/model" - participantservicelogic "gitlink.org.cn/jcce-pcm/pcm-coordinator/rpc/internal/logic/participantservice" "gitlink.org.cn/jcce-pcm/pcm-coordinator/rpc/internal/svc" "gorm.io/gorm" "strings" @@ -37,10 +36,6 @@ func InitCron(svc *svc.ServiceContext) { } }) - //p端健康检查 - svc.Cron.AddFunc("*/5 * * * * ?", func() { - participantservicelogic.CheckHealth() - }) } func updateTask(dbEngin *gorm.DB, task *model.Task, status string) { diff --git a/rpc/internal/logic/participantservice/heartbeatcheck.go b/rpc/internal/logic/participantservice/heartbeatcheck.go deleted file mode 100644 index 1b9ee410..00000000 --- a/rpc/internal/logic/participantservice/heartbeatcheck.go +++ /dev/null @@ -1,66 +0,0 @@ -package participantservicelogic - -import ( - "fmt" - "github.com/zeromicro/go-zero/core/logx" - "sync" - "time" -) - -type Client struct { - Host string - Port string - ParticipantID int64 - LastHeartbeat time.Time - ClientState string -} - -var ( - ParticipantClients = make(map[string]*Client) - clientsMutex sync.Mutex - healthCheckTime = 5 * time.Second - unhealthyTime = 15 * time.Second - removeTime = 30 * time.Second -) - -func SendHeartbeat(host string, port string, participantID int64) { - key := fmt.Sprintf("%s:%s-%d", host, port, participantID) - - clientsMutex.Lock() - defer clientsMutex.Unlock() - - if client, ok := ParticipantClients[key]; ok { - client.LastHeartbeat = time.Now() - } else { - ParticipantClients[key] = &Client{ - Host: host, - Port: port, - ParticipantID: participantID, - LastHeartbeat: time.Now(), - ClientState: "TRUE", - } - } -} - -// CheckHealth 检测心跳健康 -func CheckHealth() { - clientsMutex.Lock() - defer clientsMutex.Unlock() - - for key, client := range ParticipantClients { - if time.Since(client.LastHeartbeat) > unhealthyTime { - client.ClientState = "UNKNOWN" - if time.Since(client.LastHeartbeat) > removeTime { - delete(ParticipantClients, key) - logx.Infof("Unhealthy client removed: %s\n", key) - } - } - } -} - -// ClientList 列出监控的客户端列表 -func ClientList() (Clients map[string]*Client) { - clientsMutex.Lock() - defer clientsMutex.Unlock() - return ParticipantClients -} diff --git a/rpc/internal/logic/participantservice/listparticipantlogic.go b/rpc/internal/logic/participantservice/listparticipantlogic.go index 8cd8ea5c..cdd5ffc1 100644 --- a/rpc/internal/logic/participantservice/listparticipantlogic.go +++ b/rpc/internal/logic/participantservice/listparticipantlogic.go @@ -3,11 +3,9 @@ package participantservicelogic import ( "context" "fmt" - + "github.com/zeromicro/go-zero/core/logx" "gitlink.org.cn/jcce-pcm/pcm-coordinator/rpc/internal/svc" "gitlink.org.cn/jcce-pcm/pcm-coordinator/rpc/pcmCore" - - "github.com/zeromicro/go-zero/core/logx" ) type ListParticipantLogic struct { @@ -25,9 +23,33 @@ func NewListParticipantLogic(ctx context.Context, svcCtx *svc.ServiceContext) *L } // listParticipant 服务列表 -func (l *ListParticipantLogic) ListParticipant(in *pcmCore.ParticipantTenant) (*pcmCore.ParticipantResp, error) { +func (l *ListParticipantLogic) ListParticipant(in *pcmCore.ParticipantTenant) (*pcmCore.ParticipantServiceResp, error) { // todo: add your logic here and delete this line - clients := ClientList() - fmt.Println(clients) - return &pcmCore.ParticipantResp{}, nil + clientsMutex.Lock() + defer clientsMutex.Unlock() + rdb := l.svcCtx.RedisClient + resp := pcmCore.ParticipantServiceResp{} + clientInfo := pcmCore.ClientInfo{} + //获取所有Participant的key值 + keys, err := l.svcCtx.RedisClient.Keys(context.Background(), "ps_*").Result() + if err != nil { + logx.Errorf("Error getting keys from Redis err: %v", err) + return &pcmCore.ParticipantServiceResp{ + Code: 500, + Msg: fmt.Sprintf("get service list error %s", err), + }, nil + } + for _, key := range keys { + if err := rdb.HGetAll(l.ctx, key).Scan(&clientInfo); err != nil { + logx.Errorf("get service err:", err) + return &pcmCore.ParticipantServiceResp{ + Code: 500, + Msg: fmt.Sprintf("get service list error %s", err), + }, nil + } + resp.Data = append(resp.Data, &clientInfo) + } + resp.Code = 200 + resp.Msg = "ok" + return &resp, nil } diff --git a/rpc/internal/logic/participantservice/reportheartbeatlogic.go b/rpc/internal/logic/participantservice/reportheartbeatlogic.go index e0b92c36..9c376062 100644 --- a/rpc/internal/logic/participantservice/reportheartbeatlogic.go +++ b/rpc/internal/logic/participantservice/reportheartbeatlogic.go @@ -2,11 +2,16 @@ package participantservicelogic import ( "context" + "fmt" "github.com/zeromicro/go-zero/core/logx" "gitlink.org.cn/jcce-pcm/pcm-coordinator/rpc/internal/svc" "gitlink.org.cn/jcce-pcm/pcm-coordinator/rpc/pcmCore" + "sync" + "time" ) +var clientsMutex sync.Mutex + type ReportHeartbeatLogic struct { ctx context.Context svcCtx *svc.ServiceContext @@ -21,12 +26,20 @@ func NewReportHeartbeatLogic(ctx context.Context, svcCtx *svc.ServiceContext) *R } } -// 心跳 +// ReportHeartbeat 心跳请求 func (l *ReportHeartbeatLogic) ReportHeartbeat(in *pcmCore.ParticipantHeartbeatReq) (*pcmCore.HealthCheckResp, error) { - SendHeartbeat(in.Host, in.Port, in.ParticipantId) - for _, client := range ParticipantClients { - logx.Infof("客户端id:%d; 客户端状态:%s ;客户端最后发送心跳检测时间:%s .", client.ParticipantID, client.ClientState, client.LastHeartbeat) - } + //Participant服务key值以ps_开头 + key := fmt.Sprintf("ps_%s:%s-%d", in.Host, in.Port, in.ParticipantId) + clientsMutex.Lock() + defer clientsMutex.Unlock() + l.svcCtx.RedisClient.HSet(context.Background(), key, + map[string]interface{}{ + "host": in.Host, + "port": in.Port, + "participantId": in.ParticipantId, + "lastHeartbeat": time.Now().Unix(), + }) + l.svcCtx.RedisClient.Expire(context.Background(), key, 30*time.Second) return &pcmCore.HealthCheckResp{ Code: 200, Msg: "ok", diff --git a/rpc/internal/server/participantservice/participantserviceserver.go b/rpc/internal/server/participantservice/participantserviceserver.go index 6b5906bb..e5e86bb3 100644 --- a/rpc/internal/server/participantservice/participantserviceserver.go +++ b/rpc/internal/server/participantservice/participantserviceserver.go @@ -41,7 +41,7 @@ func (s *ParticipantServiceServer) ReportAvailable(ctx context.Context, in *pcmC } // listParticipant 服务列表 -func (s *ParticipantServiceServer) ListParticipant(ctx context.Context, in *pcmCore.ParticipantTenant) (*pcmCore.ParticipantResp, error) { +func (s *ParticipantServiceServer) ListParticipant(ctx context.Context, in *pcmCore.ParticipantTenant) (*pcmCore.ParticipantServiceResp, error) { l := participantservicelogic.NewListParticipantLogic(ctx, s.svcCtx) return l.ListParticipant(in) } diff --git a/rpc/internal/svc/servicecontext.go b/rpc/internal/svc/servicecontext.go index 81203e0a..25d8e72b 100644 --- a/rpc/internal/svc/servicecontext.go +++ b/rpc/internal/svc/servicecontext.go @@ -26,7 +26,7 @@ func NewServiceContext(c config.Config) *ServiceContext { NamingStrategy: schema.NamingStrategy{ SingularTable: true, // 使用单数表名,启用该选项,此时,`User` 的表名应该是 `t_user` }, - Logger: logger.Default.LogMode(logger.Info), + Logger: logger.Default.LogMode(logger.Warn), }) //添加snowflake支持 err := tool.InitSnowflake(c.SnowflakeConf.MachineId) diff --git a/rpc/pb/pcmCore.proto b/rpc/pb/pcmCore.proto index 5a3d39df..136fe9a7 100644 --- a/rpc/pb/pcmCore.proto +++ b/rpc/pb/pcmCore.proto @@ -206,6 +206,17 @@ message ParticipantResp{ int64 code = 1; string msg = 2; } +message ParticipantServiceResp { + int64 code = 1; + string msg = 2; + repeated ClientInfo data = 3; +} + +message ClientInfo{ + string host = 1; // @gotags: redis:"host" + string port = 2; // @gotags: redis:"port" + int64 participantId = 3; // @gotags: redis:"participantId" +} // participant 参与者 service participantService { @@ -220,7 +231,7 @@ service participantService { rpc reportAvailable (ParticipantAvailReq) returns(ParticipantResp){} // listParticipant 服务列表 - rpc listParticipant (ParticipantTenant) returns(ParticipantResp){} + rpc listParticipant (ParticipantTenant) returns(ParticipantServiceResp){} // listAvailable 集群动态信息列表 rpc listPhyAvailable (ParticipantTenant) returns(ListParticipantAvailResp){} diff --git a/rpc/pcmCore/pcmCore.pb.go b/rpc/pcmCore/pcmCore.pb.go index b6e24a6a..c3b5fc24 100644 --- a/rpc/pcmCore/pcmCore.pb.go +++ b/rpc/pcmCore/pcmCore.pb.go @@ -1779,6 +1779,132 @@ func (x *ParticipantResp) GetMsg() string { return "" } +type ParticipantServiceResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Code int64 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` + Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` + Data []*ClientInfo `protobuf:"bytes,3,rep,name=data,proto3" json:"data,omitempty"` +} + +func (x *ParticipantServiceResp) Reset() { + *x = ParticipantServiceResp{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_pcmCore_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ParticipantServiceResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ParticipantServiceResp) ProtoMessage() {} + +func (x *ParticipantServiceResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_pcmCore_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ParticipantServiceResp.ProtoReflect.Descriptor instead. +func (*ParticipantServiceResp) Descriptor() ([]byte, []int) { + return file_pb_pcmCore_proto_rawDescGZIP(), []int{19} +} + +func (x *ParticipantServiceResp) GetCode() int64 { + if x != nil { + return x.Code + } + return 0 +} + +func (x *ParticipantServiceResp) GetMsg() string { + if x != nil { + return x.Msg + } + return "" +} + +func (x *ParticipantServiceResp) GetData() []*ClientInfo { + if x != nil { + return x.Data + } + return nil +} + +type ClientInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty" redis:"host"` + Port string `protobuf:"bytes,2,opt,name=port,proto3" json:"port,omitempty" redis:"port"` + ParticipantId int64 `protobuf:"varint,3,opt,name=participantId,proto3" json:"participantId,omitempty" redis:"participantId"` +} + +func (x *ClientInfo) Reset() { + *x = ClientInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_pcmCore_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ClientInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClientInfo) ProtoMessage() {} + +func (x *ClientInfo) ProtoReflect() protoreflect.Message { + mi := &file_pb_pcmCore_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ClientInfo.ProtoReflect.Descriptor instead. +func (*ClientInfo) Descriptor() ([]byte, []int) { + return file_pb_pcmCore_proto_rawDescGZIP(), []int{20} +} + +func (x *ClientInfo) GetHost() string { + if x != nil { + return x.Host + } + return "" +} + +func (x *ClientInfo) GetPort() string { + if x != nil { + return x.Port + } + return "" +} + +func (x *ClientInfo) GetParticipantId() int64 { + if x != nil { + return x.ParticipantId + } + return 0 +} + var File_pb_pcmCore_proto protoreflect.FileDescriptor var file_pb_pcmCore_proto_rawDesc = []byte{ @@ -2036,51 +2162,63 @@ var file_pb_pcmCore_proto_rawDesc = []byte{ 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, - 0x2a, 0x33, 0x0a, 0x0d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x41, 0x49, 0x4c, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53, - 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, - 0x4f, 0x57, 0x4e, 0x10, 0x02, 0x32, 0x7b, 0x0a, 0x07, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, - 0x12, 0x37, 0x0a, 0x08, 0x53, 0x79, 0x6e, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x14, 0x2e, 0x70, - 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x52, - 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x79, 0x6e, - 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x37, 0x0a, 0x08, 0x49, 0x6e, 0x66, - 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x14, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, - 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x70, 0x63, - 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, - 0x73, 0x70, 0x32, 0xf9, 0x03, 0x0a, 0x12, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, - 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x50, 0x0a, 0x13, 0x72, 0x65, 0x67, - 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, - 0x12, 0x1a, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, - 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x50, 0x68, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x1b, 0x2e, 0x70, - 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, - 0x6e, 0x74, 0x50, 0x68, 0x79, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x4f, 0x0a, 0x0f, 0x72, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x12, 0x20, - 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, - 0x70, 0x61, 0x6e, 0x74, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, 0x71, - 0x1a, 0x18, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, - 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x4b, 0x0a, 0x0f, - 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x12, - 0x1c, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, - 0x69, 0x70, 0x61, 0x6e, 0x74, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x18, 0x2e, + 0x22, 0x67, 0x0a, 0x16, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, + 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x10, + 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, + 0x12, 0x27, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, + 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, + 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x5a, 0x0a, 0x0a, 0x43, 0x6c, 0x69, + 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, + 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, + 0x24, 0x0a, 0x0d, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x64, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, + 0x61, 0x6e, 0x74, 0x49, 0x64, 0x2a, 0x33, 0x0a, 0x0d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x41, 0x49, 0x4c, 0x10, 0x00, + 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x01, 0x12, 0x0b, 0x0a, + 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x02, 0x32, 0x7b, 0x0a, 0x07, 0x70, 0x63, + 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x12, 0x37, 0x0a, 0x08, 0x53, 0x79, 0x6e, 0x63, 0x49, 0x6e, 0x66, + 0x6f, 0x12, 0x14, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x79, 0x6e, 0x63, + 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, + 0x65, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x37, + 0x0a, 0x08, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x14, 0x2e, 0x70, 0x63, 0x6d, + 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, + 0x1a, 0x15, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x4c, + 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x32, 0x80, 0x04, 0x0a, 0x12, 0x70, 0x61, 0x72, 0x74, + 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x50, + 0x0a, 0x13, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, + 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x1a, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, + 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x50, 0x68, 0x79, 0x52, 0x65, + 0x71, 0x1a, 0x1b, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x61, 0x72, 0x74, + 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x50, 0x68, 0x79, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, + 0x12, 0x4f, 0x0a, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, + 0x65, 0x61, 0x74, 0x12, 0x20, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x61, + 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, + 0x61, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x18, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, + 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x22, + 0x00, 0x12, 0x4b, 0x0a, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x41, 0x76, 0x61, 0x69, 0x6c, + 0x61, 0x62, 0x6c, 0x65, 0x12, 0x1c, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x50, + 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x52, + 0x65, 0x71, 0x1a, 0x18, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x61, 0x72, + 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x50, + 0x0a, 0x0f, 0x6c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, + 0x74, 0x12, 0x1a, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x61, 0x72, 0x74, + 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x54, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, - 0x61, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x49, 0x0a, 0x0f, 0x6c, 0x69, 0x73, - 0x74, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x1a, 0x2e, 0x70, - 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, - 0x6e, 0x74, 0x54, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, - 0x72, 0x65, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x52, 0x65, - 0x73, 0x70, 0x22, 0x00, 0x12, 0x53, 0x0a, 0x10, 0x6c, 0x69, 0x73, 0x74, 0x50, 0x68, 0x79, 0x41, - 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x1a, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, - 0x72, 0x65, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x54, 0x65, - 0x6e, 0x61, 0x6e, 0x74, 0x1a, 0x21, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x4c, - 0x69, 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x41, 0x76, - 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x53, 0x0a, 0x12, 0x6c, 0x69, 0x73, - 0x74, 0x50, 0x68, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x1a, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, - 0x69, 0x70, 0x61, 0x6e, 0x74, 0x54, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x63, - 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, - 0x69, 0x70, 0x61, 0x6e, 0x74, 0x50, 0x68, 0x79, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x42, 0x0a, - 0x5a, 0x08, 0x2f, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x61, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, + 0x12, 0x53, 0x0a, 0x10, 0x6c, 0x69, 0x73, 0x74, 0x50, 0x68, 0x79, 0x41, 0x76, 0x61, 0x69, 0x6c, + 0x61, 0x62, 0x6c, 0x65, 0x12, 0x1a, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x50, + 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x54, 0x65, 0x6e, 0x61, 0x6e, 0x74, + 0x1a, 0x21, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, + 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x52, + 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x53, 0x0a, 0x12, 0x6c, 0x69, 0x73, 0x74, 0x50, 0x68, 0x79, + 0x49, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x2e, 0x70, 0x63, + 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, + 0x74, 0x54, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, + 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, + 0x74, 0x50, 0x68, 0x79, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x42, 0x0a, 0x5a, 0x08, 0x2f, 0x70, + 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2096,7 +2234,7 @@ func file_pb_pcmCore_proto_rawDescGZIP() []byte { } var file_pb_pcmCore_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_pb_pcmCore_proto_msgTypes = make([]protoimpl.MessageInfo, 19) +var file_pb_pcmCore_proto_msgTypes = make([]protoimpl.MessageInfo, 21) var file_pb_pcmCore_proto_goTypes = []interface{}{ (MessageStatus)(0), // 0: pcmCore.MessageStatus (*SyncInfoReq)(nil), // 1: pcmCore.SyncInfoReq @@ -2118,6 +2256,8 @@ var file_pb_pcmCore_proto_goTypes = []interface{}{ (*NodeAvailInfo)(nil), // 17: pcmCore.NodeAvailInfo (*ListParticipantAvailResp)(nil), // 18: pcmCore.ListParticipantAvailResp (*ParticipantResp)(nil), // 19: pcmCore.ParticipantResp + (*ParticipantServiceResp)(nil), // 20: pcmCore.ParticipantServiceResp + (*ClientInfo)(nil), // 21: pcmCore.ClientInfo } var file_pb_pcmCore_proto_depIdxs = []int32{ 4, // 0: pcmCore.SyncInfoReq.HpcInfoList:type_name -> pcmCore.HpcInfo @@ -2132,27 +2272,28 @@ var file_pb_pcmCore_proto_depIdxs = []int32{ 9, // 9: pcmCore.ParticipantPhyReq.labelInfo:type_name -> pcmCore.ParticipantLabel 17, // 10: pcmCore.ParticipantAvailReq.nodeAvailInfo:type_name -> pcmCore.NodeAvailInfo 16, // 11: pcmCore.ListParticipantAvailResp.ParticipantAvails:type_name -> pcmCore.ParticipantAvailReq - 1, // 12: pcmCore.pcmCore.SyncInfo:input_type -> pcmCore.SyncInfoReq - 6, // 13: pcmCore.pcmCore.InfoList:input_type -> pcmCore.InfoListReq - 13, // 14: pcmCore.participantService.registerParticipant:input_type -> pcmCore.ParticipantPhyReq - 15, // 15: pcmCore.participantService.reportHeartbeat:input_type -> pcmCore.ParticipantHeartbeatReq - 16, // 16: pcmCore.participantService.reportAvailable:input_type -> pcmCore.ParticipantAvailReq - 8, // 17: pcmCore.participantService.listParticipant:input_type -> pcmCore.ParticipantTenant - 8, // 18: pcmCore.participantService.listPhyAvailable:input_type -> pcmCore.ParticipantTenant - 8, // 19: pcmCore.participantService.listPhyInformation:input_type -> pcmCore.ParticipantTenant - 5, // 20: pcmCore.pcmCore.SyncInfo:output_type -> pcmCore.SyncInfoResp - 7, // 21: pcmCore.pcmCore.InfoList:output_type -> pcmCore.InfoListResp - 11, // 22: pcmCore.participantService.registerParticipant:output_type -> pcmCore.ParticipantPhyResp - 10, // 23: pcmCore.participantService.reportHeartbeat:output_type -> pcmCore.HealthCheckResp - 19, // 24: pcmCore.participantService.reportAvailable:output_type -> pcmCore.ParticipantResp - 19, // 25: pcmCore.participantService.listParticipant:output_type -> pcmCore.ParticipantResp - 18, // 26: pcmCore.participantService.listPhyAvailable:output_type -> pcmCore.ListParticipantAvailResp - 12, // 27: pcmCore.participantService.listPhyInformation:output_type -> pcmCore.ListParticipantPhyResp - 20, // [20:28] is the sub-list for method output_type - 12, // [12:20] is the sub-list for method input_type - 12, // [12:12] is the sub-list for extension type_name - 12, // [12:12] is the sub-list for extension extendee - 0, // [0:12] is the sub-list for field type_name + 21, // 12: pcmCore.ParticipantServiceResp.data:type_name -> pcmCore.ClientInfo + 1, // 13: pcmCore.pcmCore.SyncInfo:input_type -> pcmCore.SyncInfoReq + 6, // 14: pcmCore.pcmCore.InfoList:input_type -> pcmCore.InfoListReq + 13, // 15: pcmCore.participantService.registerParticipant:input_type -> pcmCore.ParticipantPhyReq + 15, // 16: pcmCore.participantService.reportHeartbeat:input_type -> pcmCore.ParticipantHeartbeatReq + 16, // 17: pcmCore.participantService.reportAvailable:input_type -> pcmCore.ParticipantAvailReq + 8, // 18: pcmCore.participantService.listParticipant:input_type -> pcmCore.ParticipantTenant + 8, // 19: pcmCore.participantService.listPhyAvailable:input_type -> pcmCore.ParticipantTenant + 8, // 20: pcmCore.participantService.listPhyInformation:input_type -> pcmCore.ParticipantTenant + 5, // 21: pcmCore.pcmCore.SyncInfo:output_type -> pcmCore.SyncInfoResp + 7, // 22: pcmCore.pcmCore.InfoList:output_type -> pcmCore.InfoListResp + 11, // 23: pcmCore.participantService.registerParticipant:output_type -> pcmCore.ParticipantPhyResp + 10, // 24: pcmCore.participantService.reportHeartbeat:output_type -> pcmCore.HealthCheckResp + 19, // 25: pcmCore.participantService.reportAvailable:output_type -> pcmCore.ParticipantResp + 20, // 26: pcmCore.participantService.listParticipant:output_type -> pcmCore.ParticipantServiceResp + 18, // 27: pcmCore.participantService.listPhyAvailable:output_type -> pcmCore.ListParticipantAvailResp + 12, // 28: pcmCore.participantService.listPhyInformation:output_type -> pcmCore.ListParticipantPhyResp + 21, // [21:29] is the sub-list for method output_type + 13, // [13:21] is the sub-list for method input_type + 13, // [13:13] is the sub-list for extension type_name + 13, // [13:13] is the sub-list for extension extendee + 0, // [0:13] is the sub-list for field type_name } func init() { file_pb_pcmCore_proto_init() } @@ -2389,6 +2530,30 @@ func file_pb_pcmCore_proto_init() { return nil } } + file_pb_pcmCore_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ParticipantServiceResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pb_pcmCore_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClientInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -2396,7 +2561,7 @@ func file_pb_pcmCore_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_pb_pcmCore_proto_rawDesc, NumEnums: 1, - NumMessages: 19, + NumMessages: 21, NumExtensions: 0, NumServices: 2, }, diff --git a/rpc/pcmCore/pcmCore_grpc.pb.go b/rpc/pcmCore/pcmCore_grpc.pb.go index 29d932f3..eb63b990 100644 --- a/rpc/pcmCore/pcmCore_grpc.pb.go +++ b/rpc/pcmCore/pcmCore_grpc.pb.go @@ -169,7 +169,7 @@ type ParticipantServiceClient interface { // reportAvailable 监控数据上报 ReportAvailable(ctx context.Context, in *ParticipantAvailReq, opts ...grpc.CallOption) (*ParticipantResp, error) // listParticipant 服务列表 - ListParticipant(ctx context.Context, in *ParticipantTenant, opts ...grpc.CallOption) (*ParticipantResp, error) + ListParticipant(ctx context.Context, in *ParticipantTenant, opts ...grpc.CallOption) (*ParticipantServiceResp, error) // listAvailable 集群动态信息列表 ListPhyAvailable(ctx context.Context, in *ParticipantTenant, opts ...grpc.CallOption) (*ListParticipantAvailResp, error) // listPhyInformation 集群静态信息列表 @@ -211,8 +211,8 @@ func (c *participantServiceClient) ReportAvailable(ctx context.Context, in *Part return out, nil } -func (c *participantServiceClient) ListParticipant(ctx context.Context, in *ParticipantTenant, opts ...grpc.CallOption) (*ParticipantResp, error) { - out := new(ParticipantResp) +func (c *participantServiceClient) ListParticipant(ctx context.Context, in *ParticipantTenant, opts ...grpc.CallOption) (*ParticipantServiceResp, error) { + out := new(ParticipantServiceResp) err := c.cc.Invoke(ctx, ParticipantService_ListParticipant_FullMethodName, in, out, opts...) if err != nil { return nil, err @@ -249,7 +249,7 @@ type ParticipantServiceServer interface { // reportAvailable 监控数据上报 ReportAvailable(context.Context, *ParticipantAvailReq) (*ParticipantResp, error) // listParticipant 服务列表 - ListParticipant(context.Context, *ParticipantTenant) (*ParticipantResp, error) + ListParticipant(context.Context, *ParticipantTenant) (*ParticipantServiceResp, error) // listAvailable 集群动态信息列表 ListPhyAvailable(context.Context, *ParticipantTenant) (*ListParticipantAvailResp, error) // listPhyInformation 集群静态信息列表 @@ -270,7 +270,7 @@ func (UnimplementedParticipantServiceServer) ReportHeartbeat(context.Context, *P func (UnimplementedParticipantServiceServer) ReportAvailable(context.Context, *ParticipantAvailReq) (*ParticipantResp, error) { return nil, status.Errorf(codes.Unimplemented, "method ReportAvailable not implemented") } -func (UnimplementedParticipantServiceServer) ListParticipant(context.Context, *ParticipantTenant) (*ParticipantResp, error) { +func (UnimplementedParticipantServiceServer) ListParticipant(context.Context, *ParticipantTenant) (*ParticipantServiceResp, error) { return nil, status.Errorf(codes.Unimplemented, "method ListParticipant not implemented") } func (UnimplementedParticipantServiceServer) ListPhyAvailable(context.Context, *ParticipantTenant) (*ListParticipantAvailResp, error) {