From 0c4df00ef14dfd2b6d4f5486a9cdf2d910465047 Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Wed, 18 Dec 2024 16:47:32 +0800 Subject: [PATCH] move circuit breaker to pkg Signed-off-by: Ryan Leung --- client/client.go | 2 +- client/inner_client.go | 2 +- client/opt/option.go | 2 +- client/{ => pkg}/circuitbreaker/circuit_breaker.go | 0 client/{ => pkg}/circuitbreaker/circuit_breaker_test.go | 0 errors.toml | 5 ----- pkg/errs/errno.go | 1 - tests/integrations/client/client_test.go | 2 +- 8 files changed, 4 insertions(+), 10 deletions(-) rename client/{ => pkg}/circuitbreaker/circuit_breaker.go (100%) rename client/{ => pkg}/circuitbreaker/circuit_breaker_test.go (100%) diff --git a/client/client.go b/client/client.go index 0e48707cd8d..272d6c597b5 100644 --- a/client/client.go +++ b/client/client.go @@ -34,7 +34,6 @@ import ( "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" - cb "github.com/tikv/pd/client/circuitbreaker" "github.com/tikv/pd/client/clients/metastorage" "github.com/tikv/pd/client/clients/router" "github.com/tikv/pd/client/clients/tso" @@ -43,6 +42,7 @@ import ( "github.com/tikv/pd/client/metrics" "github.com/tikv/pd/client/opt" "github.com/tikv/pd/client/pkg/caller" + cb "github.com/tikv/pd/client/pkg/circuitbreaker" "github.com/tikv/pd/client/pkg/utils/tlsutil" sd "github.com/tikv/pd/client/servicediscovery" ) diff --git a/client/inner_client.go b/client/inner_client.go index 045a9a6eed8..91f999dd3b5 100644 --- a/client/inner_client.go +++ b/client/inner_client.go @@ -15,11 +15,11 @@ import ( "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" - cb "github.com/tikv/pd/client/circuitbreaker" "github.com/tikv/pd/client/clients/tso" "github.com/tikv/pd/client/errs" "github.com/tikv/pd/client/metrics" "github.com/tikv/pd/client/opt" + cb "github.com/tikv/pd/client/pkg/circuitbreaker" sd "github.com/tikv/pd/client/servicediscovery" ) diff --git a/client/opt/option.go b/client/opt/option.go index c7a0bb17195..af95a225fab 100644 --- a/client/opt/option.go +++ b/client/opt/option.go @@ -23,7 +23,7 @@ import ( "github.com/pingcap/errors" - cb "github.com/tikv/pd/client/circuitbreaker" + cb "github.com/tikv/pd/client/pkg/circuitbreaker" "github.com/tikv/pd/client/pkg/retry" ) diff --git a/client/circuitbreaker/circuit_breaker.go b/client/pkg/circuitbreaker/circuit_breaker.go similarity index 100% rename from client/circuitbreaker/circuit_breaker.go rename to client/pkg/circuitbreaker/circuit_breaker.go diff --git a/client/circuitbreaker/circuit_breaker_test.go b/client/pkg/circuitbreaker/circuit_breaker_test.go similarity index 100% rename from client/circuitbreaker/circuit_breaker_test.go rename to client/pkg/circuitbreaker/circuit_breaker_test.go diff --git a/errors.toml b/errors.toml index 9bfd4a79190..c77a7cb842a 100644 --- a/errors.toml +++ b/errors.toml @@ -841,11 +841,6 @@ error = ''' get allocator manager failed, %s ''' -["PD:tso:ErrGetLocalAllocator"] -error = ''' -get local allocator failed, %s -''' - ["PD:tso:ErrGetMinTS"] error = ''' get min ts failed, %s diff --git a/pkg/errs/errno.go b/pkg/errs/errno.go index e5c23cffde2..354887350e7 100644 --- a/pkg/errs/errno.go +++ b/pkg/errs/errno.go @@ -41,7 +41,6 @@ var ( // tso errors var ( ErrGetAllocator = errors.Normalize("get allocator failed, %s", errors.RFCCodeText("PD:tso:ErrGetAllocator")) - ErrGetLocalAllocator = errors.Normalize("get local allocator failed, %s", errors.RFCCodeText("PD:tso:ErrGetLocalAllocator")) ErrResetUserTimestamp = errors.Normalize("reset user timestamp failed, %s", errors.RFCCodeText("PD:tso:ErrResetUserTimestamp")) ErrGenerateTimestamp = errors.Normalize("generate timestamp failed, %s", errors.RFCCodeText("PD:tso:ErrGenerateTimestamp")) ErrUpdateTimestamp = errors.Normalize("update timestamp failed, %s", errors.RFCCodeText("PD:tso:ErrUpdateTimestamp")) diff --git a/tests/integrations/client/client_test.go b/tests/integrations/client/client_test.go index c0b762d0983..fadfb952e4c 100644 --- a/tests/integrations/client/client_test.go +++ b/tests/integrations/client/client_test.go @@ -45,10 +45,10 @@ import ( "github.com/pingcap/kvproto/pkg/pdpb" pd "github.com/tikv/pd/client" - cb "github.com/tikv/pd/client/circuitbreaker" "github.com/tikv/pd/client/clients/router" "github.com/tikv/pd/client/opt" "github.com/tikv/pd/client/pkg/caller" + cb "github.com/tikv/pd/client/pkg/circuitbreaker" "github.com/tikv/pd/client/pkg/retry" sd "github.com/tikv/pd/client/servicediscovery" "github.com/tikv/pd/pkg/core"