diff options
author | Sami Hiltunen <shiltunen@gitlab.com> | 2021-03-26 11:32:21 +0300 |
---|---|---|
committer | Sami Hiltunen <shiltunen@gitlab.com> | 2021-04-01 12:50:52 +0300 |
commit | 9c08dc0188e1a00866c9c1361bfd67862bec01d7 (patch) | |
tree | 409b059fcffbef061ecf7d3414339b39ca8d766a /internal/praefect/server.go | |
parent | 54f0de751b48b23424640cd851a8222b5025f6bc (diff) |
Inject PrimaryGetter and Connection in Praefect's Info server
This commit wires up a PrimaryGetter and Connections into Praefect's
Info server as they'll be needed when converting the methods to support
variable replication factor and repository specific primaries.
ReplicationFactorSetter is also converted into AssignmentStore so the
methods can acccess assignments later.
Diffstat (limited to 'internal/praefect/server.go')
-rw-r--r-- | internal/praefect/server.go | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/internal/praefect/server.go b/internal/praefect/server.go index 0ad23f242..41e11fb33 100644 --- a/internal/praefect/server.go +++ b/internal/praefect/server.go @@ -23,6 +23,7 @@ import ( "gitlab.com/gitlab-org/gitaly/internal/praefect/middleware" "gitlab.com/gitlab-org/gitaly/internal/praefect/nodes" "gitlab.com/gitlab-org/gitaly/internal/praefect/protoregistry" + "gitlab.com/gitlab-org/gitaly/internal/praefect/service" "gitlab.com/gitlab-org/gitaly/internal/praefect/service/info" "gitlab.com/gitlab-org/gitaly/internal/praefect/service/server" "gitlab.com/gitlab-org/gitaly/internal/praefect/service/transaction" @@ -47,7 +48,9 @@ func NewGRPCServer( txMgr *transactions.Manager, queue datastore.ReplicationEventQueue, rs datastore.RepositoryStore, - rfs info.ReplicationFactorSetter, + assignmentStore AssignmentStore, + conns Connections, + primaryGetter PrimaryGetter, grpcOpts ...grpc.ServerOption, ) *grpc.Server { ctxTagOpts := []grpc_ctxtags.Option{ @@ -103,7 +106,7 @@ func NewGRPCServer( warnDupeAddrs(logger, conf) srv := grpc.NewServer(grpcOpts...) - registerServices(srv, nodeMgr, txMgr, conf, queue, rs, rfs) + registerServices(srv, nodeMgr, txMgr, conf, queue, rs, assignmentStore, service.Connections(conns), primaryGetter) return srv } @@ -115,10 +118,20 @@ func proxyRequiredOpts(director proxy.StreamDirector) []grpc.ServerOption { } // registerServices registers services praefect needs to handle RPCs on its own. -func registerServices(srv *grpc.Server, nm nodes.Manager, tm *transactions.Manager, conf config.Config, queue datastore.ReplicationEventQueue, rs datastore.RepositoryStore, rfs info.ReplicationFactorSetter) { +func registerServices( + srv *grpc.Server, + nm nodes.Manager, + tm *transactions.Manager, + conf config.Config, + queue datastore.ReplicationEventQueue, + rs datastore.RepositoryStore, + assignmentStore AssignmentStore, + conns service.Connections, + primaryGetter info.PrimaryGetter, +) { // ServerServiceServer is necessary for the ServerInfo RPC gitalypb.RegisterServerServiceServer(srv, server.NewServer(conf, nm)) - gitalypb.RegisterPraefectInfoServiceServer(srv, info.NewServer(nm, conf, queue, rs, rfs)) + gitalypb.RegisterPraefectInfoServiceServer(srv, info.NewServer(nm, conf, queue, rs, assignmentStore, conns, primaryGetter)) gitalypb.RegisterRefTransactionServer(srv, transaction.NewServer(tm)) healthpb.RegisterHealthServer(srv, health.NewServer()) |