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

server.go « repository « service « gitaly « internal - gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: dbd9fbbd97d006585f53ff07585faea29c42dde9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package repository

import (
	"gitlab.com/gitlab-org/gitaly/v14/client"
	"gitlab.com/gitlab-org/gitaly/v14/internal/cgroups"
	"gitlab.com/gitlab-org/gitaly/v14/internal/git"
	"gitlab.com/gitlab-org/gitaly/v14/internal/git/catfile"
	"gitlab.com/gitlab-org/gitaly/v14/internal/git/localrepo"
	"gitlab.com/gitlab-org/gitaly/v14/internal/git/repository"
	"gitlab.com/gitlab-org/gitaly/v14/internal/git2go"
	"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/config"
	"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/rubyserver"
	"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/storage"
	"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/transaction"
	"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
)

type server struct {
	gitalypb.UnimplementedRepositoryServiceServer
	ruby           *rubyserver.Server
	conns          *client.Pool
	locator        storage.Locator
	txManager      transaction.Manager
	gitCmdFactory  git.CommandFactory
	cfg            config.Cfg
	binDir         string
	loggingCfg     config.Logging
	catfileCache   catfile.Cache
	git2go         git2go.Executor
	cgroupsManager cgroups.Manager
}

// NewServer creates a new instance of a gRPC repo server
func NewServer(
	cfg config.Cfg,
	rs *rubyserver.Server,
	locator storage.Locator,
	txManager transaction.Manager,
	gitCmdFactory git.CommandFactory,
	catfileCache catfile.Cache,
	connsPool *client.Pool,
	cgroupsManager cgroups.Manager,
) gitalypb.RepositoryServiceServer {
	return &server{
		ruby:           rs,
		locator:        locator,
		txManager:      txManager,
		gitCmdFactory:  gitCmdFactory,
		conns:          connsPool,
		cfg:            cfg,
		binDir:         cfg.BinDir,
		loggingCfg:     cfg.Logging,
		catfileCache:   catfileCache,
		git2go:         git2go.NewExecutor(cfg, locator),
		cgroupsManager: cgroupsManager,
	}
}

func (s *server) localrepo(repo repository.GitRepo) *localrepo.Repo {
	return localrepo.New(s.gitCmdFactory, s.catfileCache, repo, s.cfg)
}