Skip to content

Commit

Permalink
*: move all util relative package to utils (#5764)
Browse files Browse the repository at this point in the history
ref #5766

*: move all util relative package to utils

Signed-off-by: nolouch <nolouch@gmail.com>
  • Loading branch information
nolouch authored Dec 8, 2022
1 parent 8c5c666 commit 8227cdb
Show file tree
Hide file tree
Showing 256 changed files with 328 additions and 328 deletions.
4 changes: 2 additions & 2 deletions cmd/pd-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import (
"github.com/tikv/pd/pkg/autoscaling"
"github.com/tikv/pd/pkg/dashboard"
"github.com/tikv/pd/pkg/errs"
"github.com/tikv/pd/pkg/logutil"
"github.com/tikv/pd/pkg/metricutil"
"github.com/tikv/pd/pkg/swaggerserver"
"github.com/tikv/pd/pkg/utils/logutil"
"github.com/tikv/pd/pkg/utils/metricutil"
"github.com/tikv/pd/server"
"github.com/tikv/pd/server/api"
"github.com/tikv/pd/server/apiv2"
Expand Down
2 changes: 1 addition & 1 deletion pkg/audit/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

"github.com/pingcap/log"
"github.com/prometheus/client_golang/prometheus"
"github.com/tikv/pd/pkg/requestutil"
"github.com/tikv/pd/pkg/utils/requestutil"
"go.uber.org/zap"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/audit/audit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/stretchr/testify/require"
"github.com/tikv/pd/pkg/requestutil"
"github.com/tikv/pd/pkg/utils/requestutil"
)

func TestLabelMatcher(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/autoscaling/calculation.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/pingcap/log"
promClient "github.com/prometheus/client_golang/api"
"github.com/tikv/pd/pkg/errs"
"github.com/tikv/pd/pkg/typeutil"
"github.com/tikv/pd/pkg/utils/typeutil"
"github.com/tikv/pd/server/cluster"
"github.com/tikv/pd/server/config"
"github.com/tikv/pd/server/core"
Expand Down
2 changes: 1 addition & 1 deletion pkg/autoscaling/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"context"
"net/http"

"github.com/tikv/pd/pkg/apiutil/serverapi"
"github.com/tikv/pd/pkg/utils/apiutil/serverapi"
"github.com/tikv/pd/server"
"github.com/unrolled/render"
"github.com/urfave/negroni"
Expand Down
2 changes: 1 addition & 1 deletion pkg/autoscaling/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"regexp"
"strings"

"github.com/tikv/pd/pkg/etcdutil"
"github.com/tikv/pd/pkg/utils/etcdutil"
"go.etcd.io/etcd/clientv3"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

package cache

import "github.com/tikv/pd/pkg/syncutil"
import "github.com/tikv/pd/pkg/utils/syncutil"

// Cache is an interface for cache system
type Cache interface {
Expand Down
2 changes: 1 addition & 1 deletion pkg/cache/fifo.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package cache
import (
"container/list"

"github.com/tikv/pd/pkg/syncutil"
"github.com/tikv/pd/pkg/utils/syncutil"
)

// FIFO is 'First-In-First-Out' cache.
Expand Down
2 changes: 1 addition & 1 deletion pkg/cache/ttl.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"time"

"github.com/pingcap/log"
"github.com/tikv/pd/pkg/syncutil"
"github.com/tikv/pd/pkg/utils/syncutil"
"go.uber.org/zap"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/dashboard/adapter/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

"github.com/pingcap/log"
"github.com/tikv/pd/pkg/errs"
"github.com/tikv/pd/pkg/logutil"
"github.com/tikv/pd/pkg/utils/logutil"
"github.com/tikv/pd/server"
"github.com/tikv/pd/server/cluster"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/dashboard/adapter/redirector.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

"github.com/pingcap/tidb-dashboard/pkg/apiserver"
"github.com/pingcap/tidb-dashboard/pkg/utils"
"github.com/tikv/pd/pkg/syncutil"
"github.com/tikv/pd/pkg/utils/syncutil"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion pkg/election/leadership.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/pingcap/kvproto/pkg/pdpb"
"github.com/pingcap/log"
"github.com/tikv/pd/pkg/errs"
"github.com/tikv/pd/pkg/etcdutil"
"github.com/tikv/pd/pkg/utils/etcdutil"
"github.com/tikv/pd/server/storage/kv"
"go.etcd.io/etcd/clientv3"
"go.etcd.io/etcd/mvcc/mvccpb"
Expand Down
2 changes: 1 addition & 1 deletion pkg/election/leadership_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"time"

"github.com/stretchr/testify/require"
"github.com/tikv/pd/pkg/etcdutil"
"github.com/tikv/pd/pkg/utils/etcdutil"
"go.etcd.io/etcd/clientv3"
"go.etcd.io/etcd/embed"
)
Expand Down
4 changes: 2 additions & 2 deletions pkg/election/lease.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (

"github.com/pingcap/log"
"github.com/tikv/pd/pkg/errs"
"github.com/tikv/pd/pkg/etcdutil"
"github.com/tikv/pd/pkg/typeutil"
"github.com/tikv/pd/pkg/utils/etcdutil"
"github.com/tikv/pd/pkg/utils/typeutil"
"go.etcd.io/etcd/clientv3"
"go.uber.org/zap"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/election/lease_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"time"

"github.com/stretchr/testify/require"
"github.com/tikv/pd/pkg/etcdutil"
"github.com/tikv/pd/pkg/utils/etcdutil"
"go.etcd.io/etcd/clientv3"
"go.etcd.io/etcd/embed"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/encryption/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

"github.com/pingcap/kvproto/pkg/encryptionpb"
"github.com/tikv/pd/pkg/errs"
"github.com/tikv/pd/pkg/typeutil"
"github.com/tikv/pd/pkg/utils/typeutil"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion pkg/encryption/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"time"

"github.com/stretchr/testify/require"
"github.com/tikv/pd/pkg/typeutil"
"github.com/tikv/pd/pkg/utils/typeutil"
)

func TestAdjustDefaultValue(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/encryption/region_crypter.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/pingcap/kvproto/pkg/encryptionpb"
"github.com/pingcap/kvproto/pkg/metapb"
"github.com/tikv/pd/pkg/errs"
"github.com/tikv/pd/pkg/typeutil"
"github.com/tikv/pd/pkg/utils/typeutil"
"github.com/tikv/pd/server/core"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/mock/mockcluster/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package mockcluster
import (
"time"

"github.com/tikv/pd/pkg/typeutil"
"github.com/tikv/pd/pkg/utils/typeutil"
"github.com/tikv/pd/server/config"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/mock/mockcluster/mockcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/pingcap/log"
"github.com/tikv/pd/pkg/errs"
"github.com/tikv/pd/pkg/mock/mockid"
"github.com/tikv/pd/pkg/typeutil"
"github.com/tikv/pd/pkg/utils/typeutil"
"github.com/tikv/pd/server/config"
"github.com/tikv/pd/server/core"
"github.com/tikv/pd/server/core/storelimit"
Expand Down
4 changes: 2 additions & 2 deletions pkg/mock/mockhbstream/mockhbstream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (
"github.com/pingcap/kvproto/pkg/pdpb"
"github.com/stretchr/testify/require"
"github.com/tikv/pd/pkg/mock/mockcluster"
"github.com/tikv/pd/pkg/testutil"
"github.com/tikv/pd/pkg/typeutil"
"github.com/tikv/pd/pkg/utils/testutil"
"github.com/tikv/pd/pkg/utils/typeutil"
"github.com/tikv/pd/server/config"
"github.com/tikv/pd/server/core"
"github.com/tikv/pd/server/schedule/hbstream"
Expand Down
2 changes: 1 addition & 1 deletion pkg/progress/progress.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"time"

"github.com/tikv/pd/pkg/errs"
"github.com/tikv/pd/pkg/syncutil"
"github.com/tikv/pd/pkg/utils/syncutil"
)

// speedStatisticalWindow is the speed calculation window
Expand Down
2 changes: 1 addition & 1 deletion pkg/ratelimit/concurrency_limiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

package ratelimit

import "github.com/tikv/pd/pkg/syncutil"
import "github.com/tikv/pd/pkg/utils/syncutil"

type concurrencyLimiter struct {
mu syncutil.RWMutex
Expand Down
2 changes: 1 addition & 1 deletion pkg/ratelimit/ratelimiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"context"
"time"

"github.com/tikv/pd/pkg/syncutil"
"github.com/tikv/pd/pkg/utils/syncutil"
"golang.org/x/time/rate"
)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/pingcap/errors"
"github.com/pingcap/log"
"github.com/tikv/pd/pkg/errs"
"github.com/tikv/pd/pkg/tempurl"
"github.com/tikv/pd/pkg/utils/tempurl"
"go.etcd.io/etcd/clientv3"
"go.etcd.io/etcd/embed"
"go.etcd.io/etcd/etcdserver"
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ func TestToTLSConfig(t *testing.T) {
t.Parallel()
re := require.New(t)
tlsConfig := TLSConfig{
KeyPath: "../../tests/client/cert/pd-server-key.pem",
CertPath: "../../tests/client/cert/pd-server.pem",
CAPath: "../../tests/client/cert/ca.pem",
KeyPath: "../../../tests/client/cert/pd-server-key.pem",
CertPath: "../../../tests/client/cert/pd-server.pem",
CAPath: "../../../tests/client/cert/ca.pem",
}
// test without bytes
_, err := tlsConfig.ToTLSConfig()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"bytes"
"encoding/json"

"github.com/tikv/pd/pkg/reflectutil"
"github.com/tikv/pd/pkg/utils/reflectutil"
)

// AddKeyValue is used to add a key value pair into `old`
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/push"
"github.com/tikv/pd/pkg/errs"
"github.com/tikv/pd/pkg/typeutil"
"github.com/tikv/pd/pkg/utils/typeutil"
)

const zeroDuration = time.Duration(0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"time"

"github.com/stretchr/testify/require"
"github.com/tikv/pd/pkg/typeutil"
"github.com/tikv/pd/pkg/utils/typeutil"
)

func TestCamelCaseToSnakeCase(t *testing.T) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"net/http"
"time"

"github.com/tikv/pd/pkg/apiutil"
"github.com/tikv/pd/pkg/utils/apiutil"
)

// RequestInfo holds service information from http.Request
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"net/http"

"github.com/stretchr/testify/require"
"github.com/tikv/pd/pkg/apiutil"
"github.com/tikv/pd/pkg/utils/apiutil"
)

// Status is used to check whether http response code is equal given code
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions plugin/scheduler_example/evict_leader.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import (
"github.com/gorilla/mux"
"github.com/pingcap/errors"
"github.com/pingcap/log"
"github.com/tikv/pd/pkg/apiutil"
"github.com/tikv/pd/pkg/errs"
"github.com/tikv/pd/pkg/syncutil"
"github.com/tikv/pd/pkg/utils/apiutil"
"github.com/tikv/pd/pkg/utils/syncutil"
"github.com/tikv/pd/server/core"
"github.com/tikv/pd/server/schedule"
"github.com/tikv/pd/server/schedule/filter"
Expand Down
2 changes: 1 addition & 1 deletion server/api/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"strconv"

"github.com/gorilla/mux"
"github.com/tikv/pd/pkg/apiutil"
"github.com/tikv/pd/pkg/errs"
"github.com/tikv/pd/pkg/utils/apiutil"
"github.com/tikv/pd/server"
"github.com/unrolled/render"
)
Expand Down
4 changes: 2 additions & 2 deletions server/api/admin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (
"github.com/pingcap/kvproto/pkg/metapb"
"github.com/pingcap/kvproto/pkg/pdpb"
"github.com/stretchr/testify/suite"
"github.com/tikv/pd/pkg/apiutil"
tu "github.com/tikv/pd/pkg/testutil"
"github.com/tikv/pd/pkg/utils/apiutil"
tu "github.com/tikv/pd/pkg/utils/testutil"
"github.com/tikv/pd/server"
"github.com/tikv/pd/server/core"
)
Expand Down
2 changes: 1 addition & 1 deletion server/api/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"net/http"

"github.com/gorilla/mux"
"github.com/tikv/pd/pkg/apiutil"
"github.com/tikv/pd/pkg/utils/apiutil"
"github.com/tikv/pd/server"
"github.com/unrolled/render"
)
Expand Down
2 changes: 1 addition & 1 deletion server/api/checker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

"github.com/pingcap/kvproto/pkg/metapb"
"github.com/stretchr/testify/suite"
tu "github.com/tikv/pd/pkg/testutil"
tu "github.com/tikv/pd/pkg/utils/testutil"
"github.com/tikv/pd/server"
)

Expand Down
2 changes: 1 addition & 1 deletion server/api/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (

"github.com/pingcap/kvproto/pkg/metapb"
"github.com/stretchr/testify/suite"
tu "github.com/tikv/pd/pkg/testutil"
tu "github.com/tikv/pd/pkg/utils/testutil"
"github.com/tikv/pd/server"
"github.com/tikv/pd/server/cluster"
"github.com/tikv/pd/server/config"
Expand Down
8 changes: 4 additions & 4 deletions server/api/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ import (
"github.com/pingcap/errcode"
"github.com/pingcap/errors"
"github.com/pingcap/log"
"github.com/tikv/pd/pkg/apiutil"
"github.com/tikv/pd/pkg/jsonutil"
"github.com/tikv/pd/pkg/logutil"
"github.com/tikv/pd/pkg/reflectutil"
"github.com/tikv/pd/pkg/utils/apiutil"
"github.com/tikv/pd/pkg/utils/jsonutil"
"github.com/tikv/pd/pkg/utils/logutil"
"github.com/tikv/pd/pkg/utils/reflectutil"
"github.com/tikv/pd/server"
"github.com/tikv/pd/server/config"
"github.com/unrolled/render"
Expand Down
4 changes: 2 additions & 2 deletions server/api/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"time"

"github.com/stretchr/testify/suite"
tu "github.com/tikv/pd/pkg/testutil"
"github.com/tikv/pd/pkg/typeutil"
tu "github.com/tikv/pd/pkg/utils/testutil"
"github.com/tikv/pd/pkg/utils/typeutil"
"github.com/tikv/pd/server"
"github.com/tikv/pd/server/config"
"github.com/tikv/pd/server/versioninfo"
Expand Down
4 changes: 2 additions & 2 deletions server/api/diagnostic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (

"github.com/pingcap/kvproto/pkg/metapb"
"github.com/stretchr/testify/suite"
"github.com/tikv/pd/pkg/apiutil"
tu "github.com/tikv/pd/pkg/testutil"
"github.com/tikv/pd/pkg/utils/apiutil"
tu "github.com/tikv/pd/pkg/utils/testutil"
"github.com/tikv/pd/server"
"github.com/tikv/pd/server/cluster"
"github.com/tikv/pd/server/config"
Expand Down
2 changes: 1 addition & 1 deletion server/api/etcd_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"testing"

"github.com/stretchr/testify/require"
tu "github.com/tikv/pd/pkg/testutil"
tu "github.com/tikv/pd/pkg/utils/testutil"
)

func TestGRPCGateway(t *testing.T) {
Expand Down
Loading

0 comments on commit 8227cdb

Please sign in to comment.