Skip to content

Commit 2e4969b

Browse files
authored
fix:ratelimit server spec dep (#163)
1 parent e72071e commit 2e4969b

File tree

11 files changed

+15
-1152
lines changed

11 files changed

+15
-1152
lines changed

go.mod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,12 @@ require (
1919
github.com/modern-go/reflect2 v1.0.2
2020
github.com/natefinch/lumberjack v2.0.0+incompatible
2121
github.com/pkg/errors v0.9.1
22-
github.com/polarismesh/specification v1.4.0-alpha.5
22+
github.com/polarismesh/specification v1.4.0
2323
github.com/prometheus/client_golang v1.12.2
2424
github.com/smartystreets/goconvey v1.7.2
2525
github.com/spaolacci/murmur3 v1.1.0
2626
github.com/stretchr/testify v1.8.2
2727
go.uber.org/zap v1.21.0
28-
golang.org/x/net v0.2.0
2928
google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a // indirect
3029
google.golang.org/grpc v1.51.0
3130
google.golang.org/protobuf v1.28.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
380380
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
381381
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
382382
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
383-
github.com/polarismesh/specification v1.4.0-alpha.5 h1:1bUiGB2DdL6wlli+TfJ2EoDLcR58fAUzm9FxKLtVBE0=
384-
github.com/polarismesh/specification v1.4.0-alpha.5/go.mod h1:rDvMMtl5qebPmqiBLNa5Ps0XtwkP31ZLirbH4kXA0YU=
383+
github.com/polarismesh/specification v1.4.0 h1:fm7sUtFZC2g9+lLmRCtjGrUow47CY5JDFoZXwwCQGGY=
384+
github.com/polarismesh/specification v1.4.0/go.mod h1:rDvMMtl5qebPmqiBLNa5Ps0XtwkP31ZLirbH4kXA0YU=
385385
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
386386
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
387387
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=

pkg/flow/quota/remote.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ package quota
2020
import (
2121
"context"
2222
"fmt"
23-
"github.com/polarismesh/specification/source/go/api/v1/traffic_manage/ratelimiter"
2423
"io"
2524
"net"
2625
"strings"
@@ -30,14 +29,15 @@ import (
3029

3130
"github.com/golang/protobuf/jsonpb"
3231
"github.com/modern-go/reflect2"
32+
"github.com/polarismesh/specification/source/go/api/v1/traffic_manage/ratelimiter"
3333
"google.golang.org/grpc"
3434
"google.golang.org/grpc/credentials/insecure"
3535
"google.golang.org/grpc/metadata"
3636

3737
"github.com/polarismesh/polaris-go/pkg/config"
3838
"github.com/polarismesh/polaris-go/pkg/log"
3939
"github.com/polarismesh/polaris-go/pkg/model"
40-
rlimitV2 "github.com/polarismesh/polaris-go/pkg/model/pb/metric/v2"
40+
limitpb "github.com/polarismesh/polaris-go/pkg/model/pb/metric/v2"
4141
)
4242

4343
// ResponseCallBack 应答回调函数
@@ -55,7 +55,7 @@ type RateLimitMsgSender interface {
5555
// SendInitRequest 发送初始化请求
5656
SendInitRequest(request *ratelimiter.RateLimitInitRequest, callback ResponseCallBack)
5757
// SendReportRequest 发送上报请求
58-
SendReportRequest(request *rlimitV2.ClientRateLimitReportRequest) error
58+
SendReportRequest(request *limitpb.ClientRateLimitReportRequest) error
5959
// AdjustTime 同步时间
6060
AdjustTime() int64
6161
}
@@ -510,7 +510,7 @@ func (s *StreamCounterSet) processResponse(serviceStream ratelimiter.RateLimitGR
510510
}
511511

512512
// SendReportRequest 发送上报请求
513-
func (s *StreamCounterSet) SendReportRequest(clientReportReq *rlimitV2.ClientRateLimitReportRequest) error {
513+
func (s *StreamCounterSet) SendReportRequest(clientReportReq *limitpb.ClientRateLimitReportRequest) error {
514514
s.mutex.RLock()
515515
defer s.mutex.RUnlock()
516516
if reflect2.IsNil(s.serviceStream) {

pkg/flow/quota/window.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import (
3333
"github.com/polarismesh/polaris-go/pkg/log"
3434
"github.com/polarismesh/polaris-go/pkg/model"
3535
"github.com/polarismesh/polaris-go/pkg/model/pb"
36-
rlimitV2 "github.com/polarismesh/polaris-go/pkg/model/pb/metric/v2"
36+
limitpb "github.com/polarismesh/polaris-go/pkg/model/pb/metric/v2"
3737
"github.com/polarismesh/polaris-go/pkg/plugin"
3838
"github.com/polarismesh/polaris-go/pkg/plugin/common"
3939
"github.com/polarismesh/polaris-go/pkg/plugin/ratelimiter"
@@ -563,8 +563,8 @@ func (r *RateLimitWindow) EnsureDeleted(value interface{}) bool {
563563
}
564564

565565
// acquireRequest 转换成限流PB上报消息
566-
func (r *RateLimitWindow) acquireRequest() *rlimitV2.ClientRateLimitReportRequest {
567-
reportReq := &rlimitV2.ClientRateLimitReportRequest{
566+
func (r *RateLimitWindow) acquireRequest() *limitpb.ClientRateLimitReportRequest {
567+
reportReq := &limitpb.ClientRateLimitReportRequest{
568568
Service: r.SvcKey.Service,
569569
Namespace: r.SvcKey.Namespace,
570570
Labels: r.Labels,

0 commit comments

Comments
 (0)