Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavlo Strokov <pstrokov@gitlab.com>2021-07-11 19:01:40 +0300
committerPavlo Strokov <pstrokov@gitlab.com>2021-07-12 15:03:37 +0300
commit745145608d93908b9ad2c8018093c3c12ae793bc (patch)
tree270bec38f4364eb59d83c6c04e2eabcb3e4b9acf
parenta6a4d567fd173e71886123f1f3b09b3700afaa18 (diff)
Remove unused declarations
Some functions, types, fields and other variables are not used. There is no reason to keep them and support. Some of them became redundant starting from declaration and some after the code changes.
-rw-r--r--internal/git/gittest/commit.go8
-rw-r--r--internal/gitaly/rubyserver/proxy.go28
-rw-r--r--internal/metadata/featureflag/context.go15
-rw-r--r--internal/praefect/metrics/prometheus.go8
-rw-r--r--internal/praefect/reconciler/reconciler_test.go4
-rw-r--r--internal/praefect/replicator.go19
-rw-r--r--internal/tempdir/tempdir.go3
-rw-r--r--internal/testhelper/promtest/gauge.go7
-rw-r--r--internal/testhelper/testserver/gitaly.go8
9 files changed, 0 insertions, 100 deletions
diff --git a/internal/git/gittest/commit.go b/internal/git/gittest/commit.go
index d84922548..5fe60ac7e 100644
--- a/internal/git/gittest/commit.go
+++ b/internal/git/gittest/commit.go
@@ -157,14 +157,6 @@ func authorEqualIgnoringDate(t testing.TB, expected *gitalypb.CommitAuthor, actu
require.Equal(t, expected.GetEmail(), actual.GetEmail(), "author mail does not match")
}
-// AuthorEqual tests if two `CommitAuthor`s are equal.
-func AuthorEqual(t testing.TB, expected *gitalypb.CommitAuthor, actual *gitalypb.CommitAuthor) {
- t.Helper()
- authorEqualIgnoringDate(t, expected, actual)
- require.Equal(t, expected.GetDate().GetSeconds(), actual.GetDate().GetSeconds(),
- "date does not match")
-}
-
// CommitEqual tests if two `GitCommit`s are equal
func CommitEqual(t testing.TB, expected, actual *gitalypb.GitCommit) {
t.Helper()
diff --git a/internal/gitaly/rubyserver/proxy.go b/internal/gitaly/rubyserver/proxy.go
index 76e8e1a27..62fb2679c 100644
--- a/internal/gitaly/rubyserver/proxy.go
+++ b/internal/gitaly/rubyserver/proxy.go
@@ -96,31 +96,3 @@ func Proxy(recvSend func() error) (err error) {
type CloseSender interface {
CloseSend() error
}
-
-// ProxyBidi works like Proxy but runs multiple callbacks simultaneously.
-// It returns immediately if proxying one of the callbacks fails. If the
-// response stream is done, ProxyBidi returns immediately without waiting
-// for the client stream to finish proxying.
-func ProxyBidi(requestFunc func() error, requestStream CloseSender, responseFunc func() error) error {
- requestErr := make(chan error, 1)
- go func() {
- requestErr <- Proxy(requestFunc)
- }()
-
- responseErr := make(chan error, 1)
- go func() {
- responseErr <- Proxy(responseFunc)
- }()
-
- for {
- select {
- case err := <-requestErr:
- if err != nil {
- return err
- }
- requestStream.CloseSend()
- case err := <-responseErr:
- return err
- }
- }
-}
diff --git a/internal/metadata/featureflag/context.go b/internal/metadata/featureflag/context.go
index 94100d24a..a7510ec7f 100644
--- a/internal/metadata/featureflag/context.go
+++ b/internal/metadata/featureflag/context.go
@@ -90,21 +90,6 @@ func incomingCtxWithFeatureFlagValue(ctx context.Context, key string, enabled bo
return metadata.NewIncomingContext(ctx, md)
}
-// OutgoingCtxWithRubyFeatureFlags returns a new context populated with outgoing metadata that
-// has the given set of Ruby feature flags enabled.
-func OutgoingCtxWithRubyFeatureFlags(ctx context.Context, flags ...FeatureFlag) context.Context {
- md, ok := metadata.FromOutgoingContext(ctx)
- if !ok {
- md = metadata.New(map[string]string{})
- }
-
- for _, flag := range flags {
- md.Set(rubyHeaderKey(flag.Name), "true")
- }
-
- return metadata.NewOutgoingContext(ctx, md)
-}
-
// OutgoingCtxWithRubyFeatureFlagValue returns context populated with outgoing metadata
// that contains ruby feature flags passed in.
func OutgoingCtxWithRubyFeatureFlagValue(ctx context.Context, flag FeatureFlag, val string) context.Context {
diff --git a/internal/praefect/metrics/prometheus.go b/internal/praefect/metrics/prometheus.go
index 64e4eee52..2f0b55bee 100644
--- a/internal/praefect/metrics/prometheus.go
+++ b/internal/praefect/metrics/prometheus.go
@@ -78,14 +78,6 @@ var NodeLastHealthcheckGauge = promauto.NewGaugeVec(
}, []string{"gitaly_storage"},
)
-var ChecksumMismatchCounter = promauto.NewCounterVec(
- prometheus.CounterOpts{
- Namespace: "gitaly",
- Subsystem: "praefect",
- Name: "checksum_mismatch_total",
- }, []string{"target", "source"},
-)
-
// ReadDistribution counts how many read operations was routed to each storage.
var ReadDistribution = promauto.NewCounterVec(
prometheus.CounterOpts{
diff --git a/internal/praefect/reconciler/reconciler_test.go b/internal/praefect/reconciler/reconciler_test.go
index 1bc512253..7f034b60b 100644
--- a/internal/praefect/reconciler/reconciler_test.go
+++ b/internal/praefect/reconciler/reconciler_test.go
@@ -35,10 +35,6 @@ func getDB(tb testing.TB) glsql.DB {
return glsql.GetDB(tb, "reconciler")
}
-func getStorageMethod(storage string) func() string {
- return func() string { return storage }
-}
-
func TestReconciler(t *testing.T) {
// repositories describes storage state as
// virtual storage -> relative path -> physical storage -> generation
diff --git a/internal/praefect/replicator.go b/internal/praefect/replicator.go
index 5bd48f637..52151023a 100644
--- a/internal/praefect/replicator.go
+++ b/internal/praefect/replicator.go
@@ -417,8 +417,6 @@ type ReplMgr struct {
replDelayMetric prommetrics.HistogramVec
replJobTimeout time.Duration
dequeueBatchSize uint
- // allowlist contains the project names of the repos we wish to replicate
- allowlist map[string]struct{}
}
// ReplMgrOpt allows a replicator to be configured with additional options
@@ -451,7 +449,6 @@ func NewReplMgr(log *logrus.Entry, virtualStorages []string, queue datastore.Rep
r := ReplMgr{
log: log.WithField("component", "replication_manager"),
queue: queue,
- allowlist: map[string]struct{}{},
replicator: defaultReplicator{rs: rs, log: log.WithField("component", "replicator")},
virtualStorages: virtualStorages,
hc: hc,
@@ -482,22 +479,6 @@ func (r ReplMgr) Collect(ch chan<- prometheus.Metric) {
r.replInFlightMetric.Collect(ch)
}
-// WithAllowlist will configure a allowlist for repos to allow replication
-func WithAllowlist(allowlistedRepos []string) ReplMgrOpt {
- return func(r *ReplMgr) {
- for _, repo := range allowlistedRepos {
- r.allowlist[repo] = struct{}{}
- }
- }
-}
-
-// WithReplicator overrides the default replicator
-func WithReplicator(r Replicator) ReplMgrOpt {
- return func(rm *ReplMgr) {
- rm.replicator = r
- }
-}
-
const (
logWithReplTarget = "replication_job_target"
logWithCorrID = "correlation_id"
diff --git a/internal/tempdir/tempdir.go b/internal/tempdir/tempdir.go
index 8851b6d71..9e48b515d 100644
--- a/internal/tempdir/tempdir.go
+++ b/internal/tempdir/tempdir.go
@@ -49,9 +49,6 @@ func CacheDir(storage config.Storage) string { return AppendCacheDir(storage.Pat
// provided
func AppendCacheDir(storagePath string) string { return filepath.Join(storagePath, cachePrefix) }
-// StateDir returns the path to the state dir for a storage location
-func StateDir(storage config.Storage) string { return AppendStateDir(storage.Path) }
-
// AppendStateDir will append the state directory convention to the storage path
// provided
func AppendStateDir(storagePath string) string { return filepath.Join(storagePath, statePrefix) }
diff --git a/internal/testhelper/promtest/gauge.go b/internal/testhelper/promtest/gauge.go
index 084655e11..5440b16b7 100644
--- a/internal/testhelper/promtest/gauge.go
+++ b/internal/testhelper/promtest/gauge.go
@@ -46,13 +46,6 @@ type MockStorageGauge struct {
*MockGauge
}
-// NewMockStorageGauge returns an initialized mock storage gauge
-func NewMockStorageGauge() *MockStorageGauge {
- return &MockStorageGauge{
- &MockGauge{},
- }
-}
-
// Inc will track total calls to this method while ignoring params
func (m *MockStorageGauge) Inc(_, _ string) {
m.MockGauge.Inc()
diff --git a/internal/testhelper/testserver/gitaly.go b/internal/testhelper/testserver/gitaly.go
index a7a63ebd1..df54fa39c 100644
--- a/internal/testhelper/testserver/gitaly.go
+++ b/internal/testhelper/testserver/gitaly.go
@@ -410,14 +410,6 @@ func WithBackchannelRegistry(backchannelReg *backchannel.Registry) GitalyServerO
}
}
-// WithCatfileCache sets catfile.Cache instance that will be used for gitaly services initialisation.
-func WithCatfileCache(catfileCache catfile.Cache) GitalyServerOpt {
- return func(deps gitalyServerDeps) gitalyServerDeps {
- deps.catfileCache = catfileCache
- return deps
- }
-}
-
// WithDiskCache sets the cache.Cache instance that will be used for gitaly services initialisation.
func WithDiskCache(diskCache cache.Cache) GitalyServerOpt {
return func(deps gitalyServerDeps) gitalyServerDeps {