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

server.go « hook « service « gitaly « internal - gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5fc8249ae7cc96ef1e27c4886b237f2ebd2092be (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
package hook

import (
	"context"
	"io"

	"gitlab.com/gitlab-org/gitaly/v15/internal/git"
	gitalyhook "gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/hook"
	"gitlab.com/gitlab-org/gitaly/v15/internal/middleware/limithandler"
	"gitlab.com/gitlab-org/gitaly/v15/internal/streamcache"
	"gitlab.com/gitlab-org/gitaly/v15/proto/go/gitalypb"
)

type server struct {
	gitalypb.UnimplementedHookServiceServer
	manager            gitalyhook.Manager
	gitCmdFactory      git.CommandFactory
	packObjectsCache   streamcache.Cache
	concurrencyTracker *gitalyhook.ConcurrencyTracker
	packObjectsLimiter *limithandler.ConcurrencyLimiter
	runPackObjectsFn   func(
		context.Context,
		git.CommandFactory,
		io.Writer,
		*gitalypb.PackObjectsHookWithSidechannelRequest,
		*packObjectsArgs,
		io.Reader,
		string,
		*gitalyhook.ConcurrencyTracker,
	) error
}

// NewServer creates a new instance of a gRPC namespace server
func NewServer(
	manager gitalyhook.Manager,
	gitCmdFactory git.CommandFactory,
	packObjectsCache streamcache.Cache,
	concurrencyTracker *gitalyhook.ConcurrencyTracker,
	packObjectsLimiter *limithandler.ConcurrencyLimiter,
) gitalypb.HookServiceServer {
	srv := &server{
		manager:            manager,
		gitCmdFactory:      gitCmdFactory,
		packObjectsCache:   packObjectsCache,
		packObjectsLimiter: packObjectsLimiter,
		concurrencyTracker: concurrencyTracker,
		runPackObjectsFn:   runPackObjects,
	}

	return srv
}