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

register.go « setup « service « gitaly « internal - gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 32746ce4a6f6a90c8574434b897c8a803ae41e01 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
package setup

import (
	grpcprometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
	"github.com/prometheus/client_golang/prometheus"
	"github.com/prometheus/client_golang/prometheus/promauto"
	"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service"
	"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/blob"
	"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/cleanup"
	"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/commit"
	"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/conflicts"
	"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/diff"
	"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/hook"
	"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/internalgitaly"
	"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/namespace"
	"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/objectpool"
	"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/operations"
	"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/ref"
	"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/remote"
	"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/repository"
	"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/server"
	"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/smarthttp"
	"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/ssh"
	"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/wiki"
	"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
	"google.golang.org/grpc"
	"google.golang.org/grpc/health"
	healthpb "google.golang.org/grpc/health/grpc_health_v1"
	"google.golang.org/grpc/reflection"
)

var (
	smarthttpPackfileNegotiationMetrics = promauto.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "gitaly",
			Subsystem: "smarthttp",
			Name:      "packfile_negotiation_requests_total",
			Help:      "Total number of features used for packfile negotiations",
		},
		[]string{"git_negotiation_feature"},
	)

	sshPackfileNegotiationMetrics = promauto.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "gitaly",
			Subsystem: "ssh",
			Name:      "packfile_negotiation_requests_total",
			Help:      "Total number of features used for packfile negotiations",
		},
		[]string{"git_negotiation_feature"},
	)
)

// RegisterAll will register all the known gRPC services on  the provided gRPC service instance.
func RegisterAll(srv *grpc.Server, deps *service.Dependencies) {
	gitalypb.RegisterBlobServiceServer(srv, blob.NewServer(
		deps.GetLocator(),
		deps.GetGitCmdFactory(),
		deps.GetCatfileCache(),
	))
	gitalypb.RegisterCleanupServiceServer(srv, cleanup.NewServer(
		deps.GetLocator(),
		deps.GetGitCmdFactory(),
		deps.GetCatfileCache(),
	))
	gitalypb.RegisterCommitServiceServer(srv, commit.NewServer(
		deps.GetLocator(),
		deps.GetGitCmdFactory(),
		deps.GetLinguist(),
		deps.GetCatfileCache(),
	))
	gitalypb.RegisterDiffServiceServer(srv, diff.NewServer(
		deps.GetLocator(),
		deps.GetGitCmdFactory(),
		deps.GetCatfileCache(),
	))
	gitalypb.RegisterNamespaceServiceServer(srv, namespace.NewServer(deps.GetLocator()))
	gitalypb.RegisterOperationServiceServer(srv, operations.NewServer(
		deps.GetHookManager(),
		deps.GetTxManager(),
		deps.GetLocator(),
		deps.GetConnsPool(),
		deps.GetGit2goExecutor(),
		deps.GetGitCmdFactory(),
		deps.GetCatfileCache(),
		deps.GetUpdaterWithHooks(),
	))
	gitalypb.RegisterRefServiceServer(srv, ref.NewServer(
		deps.GetLocator(),
		deps.GetGitCmdFactory(),
		deps.GetTxManager(),
		deps.GetCatfileCache(),
	))
	gitalypb.RegisterRepositoryServiceServer(srv, repository.NewServer(
		deps.GetCfg(),
		deps.GetRubyServer(),
		deps.GetLocator(),
		deps.GetTxManager(),
		deps.GetGitCmdFactory(),
		deps.GetCatfileCache(),
		deps.GetConnsPool(),
		deps.GetGit2goExecutor(),
		deps.GetHousekeepingManager(),
	))
	gitalypb.RegisterSSHServiceServer(srv, ssh.NewServer(
		deps.GetLocator(),
		deps.GetGitCmdFactory(),
		deps.GetTxManager(),
		ssh.WithPackfileNegotiationMetrics(sshPackfileNegotiationMetrics),
	))
	gitalypb.RegisterSmartHTTPServiceServer(srv, smarthttp.NewServer(
		deps.GetLocator(),
		deps.GetGitCmdFactory(),
		deps.GetTxManager(),
		deps.GetDiskCache(),
		smarthttp.WithPackfileNegotiationMetrics(smarthttpPackfileNegotiationMetrics),
	))
	gitalypb.RegisterWikiServiceServer(srv, wiki.NewServer(deps.GetRubyServer(), deps.GetLocator()))
	gitalypb.RegisterConflictsServiceServer(srv, conflicts.NewServer(
		deps.GetHookManager(),
		deps.GetLocator(),
		deps.GetGitCmdFactory(),
		deps.GetCatfileCache(),
		deps.GetConnsPool(),
		deps.GetGit2goExecutor(),
		deps.GetUpdaterWithHooks(),
	))
	gitalypb.RegisterRemoteServiceServer(srv, remote.NewServer(
		deps.GetLocator(),
		deps.GetGitCmdFactory(),
		deps.GetCatfileCache(),
		deps.GetTxManager(),
		deps.GetConnsPool(),
	))
	gitalypb.RegisterServerServiceServer(srv, server.NewServer(deps.GetGitCmdFactory(), deps.GetCfg().Storages))
	gitalypb.RegisterObjectPoolServiceServer(srv, objectpool.NewServer(
		deps.GetLocator(),
		deps.GetGitCmdFactory(),
		deps.GetCatfileCache(),
		deps.GetTxManager(),
		deps.GetHousekeepingManager(),
	))
	gitalypb.RegisterHookServiceServer(srv, hook.NewServer(
		deps.GetHookManager(),
		deps.GetGitCmdFactory(),
		deps.GetPackObjectsCache(),
	))
	gitalypb.RegisterInternalGitalyServer(srv, internalgitaly.NewServer(deps.GetCfg().Storages))

	healthpb.RegisterHealthServer(srv, health.NewServer())
	reflection.Register(srv)
	grpcprometheus.Register(srv)
}