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:
authorWill Chandler <wchandler@gitlab.com>2023-07-27 16:05:27 +0300
committerWill Chandler <wchandler@gitlab.com>2023-07-28 20:39:08 +0300
commitd6615e048843869771ac3da934e0ee54d289adb2 (patch)
tree3b411bbc993b5debacf8902be547c4174a904955 /internal/testhelper/testserver/gitaly.go
parent9374616416692d67ccf342d060d7bfec1800fc01 (diff)
counter: Wire up RepositoryCounter to repoutil
All repository creation and removal is done via `repoutil`, so hooking `RepositoryCounter` in here will allow us to track changes without dealing with the idiosyncracies of the many RPCs that may create repositories. Add a `RepositoryCounter` as a parameter to the `repoutil.Create` and `repoutil.Remove` functions and wire it up to necessary services. The exception to this is the `RemoveAll` RPC which deletes an entire storage, we use the counter directly here.
Diffstat (limited to 'internal/testhelper/testserver/gitaly.go')
-rw-r--r--internal/testhelper/testserver/gitaly.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/internal/testhelper/testserver/gitaly.go b/internal/testhelper/testserver/gitaly.go
index aca958d2d..8e44b7839 100644
--- a/internal/testhelper/testserver/gitaly.go
+++ b/internal/testhelper/testserver/gitaly.go
@@ -27,6 +27,7 @@ import (
"gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/server"
"gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/service"
"gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/storage"
+ "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/storage/counter"
"gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/storage/storagemgr"
"gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/transaction"
"gitlab.com/gitlab-org/gitaly/v16/internal/gitlab"
@@ -266,6 +267,7 @@ type gitalyServerDeps struct {
packObjectsCache streamcache.Cache
packObjectsLimiter limiter.Limiter
limitHandler *limithandler.LimiterMiddleware
+ repositoryCounter *counter.RepositoryCounter
git2goExecutor *git2go.Executor
updaterWithHooks *updateref.UpdaterWithHooks
housekeepingManager housekeeping.Manager
@@ -337,6 +339,10 @@ func (gsd *gitalyServerDeps) createDependencies(tb testing.TB, cfg config.Cfg) *
gsd.limitHandler = limithandler.New(cfg, limithandler.LimitConcurrencyByRepo, limithandler.WithConcurrencyLimiters)
}
+ if gsd.repositoryCounter == nil {
+ gsd.repositoryCounter = counter.NewRepositoryCounter()
+ }
+
if gsd.git2goExecutor == nil {
gsd.git2goExecutor = git2go.NewExecutor(cfg, gsd.gitCmdFactory, gsd.locator)
}
@@ -381,6 +387,7 @@ func (gsd *gitalyServerDeps) createDependencies(tb testing.TB, cfg config.Cfg) *
PackObjectsCache: gsd.packObjectsCache,
PackObjectsLimiter: gsd.packObjectsLimiter,
LimitHandler: gsd.limitHandler,
+ RepositoryCounter: gsd.repositoryCounter,
Git2goExecutor: gsd.git2goExecutor,
UpdaterWithHooks: gsd.updaterWithHooks,
HousekeepingManager: gsd.housekeepingManager,
@@ -466,6 +473,14 @@ func WithDiskCache(diskCache cache.Cache) GitalyServerOpt {
}
}
+// WithRepositoryCounter sets the counter.RepositoryCounter instance that will be used for gitaly services initialisation.
+func WithRepositoryCounter(repositoryCounter *counter.RepositoryCounter) GitalyServerOpt {
+ return func(deps gitalyServerDeps) gitalyServerDeps {
+ deps.repositoryCounter = repositoryCounter
+ return deps
+ }
+}
+
// WithPackObjectsLimiter sets the PackObjectsLimiter that will be
// used for gitaly services initialization.
func WithPackObjectsLimiter(limiter *limiter.ConcurrencyLimiter) GitalyServerOpt {