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:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2021-05-05 13:58:46 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-05-10 09:26:28 +0300
commit38e1e63ccdf1309035927d955f97b3700ab03c92 (patch)
treec76d42a07e8859b9ff9581a5931e33fc988d2c7b
parent3dfd3bf60e26b5a64e8ae24735aecb2d6e3af141 (diff)
conflicts: Inject catfile cache
Instead of using the global catfile cache, refactor the service to use the injected catfile cache.
-rw-r--r--internal/gitaly/service/conflicts/server.go5
-rw-r--r--internal/gitaly/service/conflicts/testhelper_test.go7
-rw-r--r--internal/gitaly/service/setup/register.go7
3 files changed, 16 insertions, 3 deletions
diff --git a/internal/gitaly/service/conflicts/server.go b/internal/gitaly/service/conflicts/server.go
index 52392ead4..d7f359e39 100644
--- a/internal/gitaly/service/conflicts/server.go
+++ b/internal/gitaly/service/conflicts/server.go
@@ -3,6 +3,7 @@ package conflicts
import (
"gitlab.com/gitlab-org/gitaly/client"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/catfile"
"gitlab.com/gitlab-org/gitaly/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/internal/git/repository"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
@@ -14,15 +15,17 @@ type server struct {
cfg config.Cfg
locator storage.Locator
gitCmdFactory git.CommandFactory
+ catfileCache catfile.Cache
pool *client.Pool
}
// NewServer creates a new instance of a grpc ConflictsServer
-func NewServer(cfg config.Cfg, locator storage.Locator, gitCmdFactory git.CommandFactory) gitalypb.ConflictsServiceServer {
+func NewServer(cfg config.Cfg, locator storage.Locator, gitCmdFactory git.CommandFactory, catfileCache catfile.Cache) gitalypb.ConflictsServiceServer {
return &server{
cfg: cfg,
locator: locator,
gitCmdFactory: gitCmdFactory,
+ catfileCache: catfileCache,
pool: client.NewPoolWithOptions(
client.WithDialer(client.HealthCheckDialer(client.DialContext)),
client.WithDialOptions(client.FailOnNonTempDialError()...),
diff --git a/internal/gitaly/service/conflicts/testhelper_test.go b/internal/gitaly/service/conflicts/testhelper_test.go
index e5a9ec13c..35cd6803b 100644
--- a/internal/gitaly/service/conflicts/testhelper_test.go
+++ b/internal/gitaly/service/conflicts/testhelper_test.go
@@ -72,7 +72,12 @@ func SetupConflictsService(t testing.TB, bare bool) (config.Cfg, *gitalypb.Repos
func runConflictsServer(t testing.TB, cfg config.Cfg) string {
return testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
- gitalypb.RegisterConflictsServiceServer(srv, NewServer(deps.GetCfg(), deps.GetLocator(), deps.GetGitCmdFactory()))
+ gitalypb.RegisterConflictsServiceServer(srv, NewServer(
+ deps.GetCfg(),
+ deps.GetLocator(),
+ deps.GetGitCmdFactory(),
+ deps.GetCatfileCache(),
+ ))
gitalypb.RegisterRepositoryServiceServer(srv, repository.NewServer(
deps.GetCfg(),
deps.GetRubyServer(),
diff --git a/internal/gitaly/service/setup/register.go b/internal/gitaly/service/setup/register.go
index 475250dae..75f2323f5 100644
--- a/internal/gitaly/service/setup/register.go
+++ b/internal/gitaly/service/setup/register.go
@@ -111,7 +111,12 @@ func RegisterAll(srv *grpc.Server, deps *service.Dependencies) {
smarthttp.WithPackfileNegotiationMetrics(smarthttpPackfileNegotiationMetrics),
))
gitalypb.RegisterWikiServiceServer(srv, wiki.NewServer(deps.GetRubyServer(), deps.GetLocator()))
- gitalypb.RegisterConflictsServiceServer(srv, conflicts.NewServer(deps.GetCfg(), deps.GetLocator(), deps.GetGitCmdFactory()))
+ gitalypb.RegisterConflictsServiceServer(srv, conflicts.NewServer(
+ deps.GetCfg(),
+ deps.GetLocator(),
+ deps.GetGitCmdFactory(),
+ deps.GetCatfileCache(),
+ ))
gitalypb.RegisterRemoteServiceServer(srv, remote.NewServer(deps.GetCfg(), deps.GetRubyServer(), deps.GetLocator(), deps.GetGitCmdFactory()))
gitalypb.RegisterServerServiceServer(srv, server.NewServer(deps.GetGitCmdFactory(), deps.GetCfg().Storages))
gitalypb.RegisterObjectPoolServiceServer(srv, objectpool.NewServer(