server

package
v16.11.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GitalyServerFactory

type GitalyServerFactory struct {
	// contains filtered or unexported fields
}

GitalyServerFactory is a factory of gitaly grpc servers

func NewGitalyServerFactory

func NewGitalyServerFactory(
	cfg config.Cfg,
	logger log.Logger,
	registry *backchannel.Registry,
	cacheInvalidator cache.Invalidator,
	limitHandlers []*limithandler.LimiterMiddleware,
	txMiddleware TransactionMiddleware,
) *GitalyServerFactory

NewGitalyServerFactory allows to create and start secure/insecure 'grpc.Server's.

func (*GitalyServerFactory) CreateExternal

func (s *GitalyServerFactory) CreateExternal(secure bool, opts ...Option) (*grpc.Server, error)

CreateExternal creates a new external gRPC server. The external servers are closed before the internal servers when gracefully shutting down.

func (*GitalyServerFactory) CreateInternal

func (s *GitalyServerFactory) CreateInternal(opts ...Option) (*grpc.Server, error)

CreateInternal creates a new internal gRPC server. Internal servers are closed after the external ones when gracefully shutting down.

func (*GitalyServerFactory) GracefulStop

func (s *GitalyServerFactory) GracefulStop()

GracefulStop gracefully stops all servers created by the GitalyServerFactory. ExternalServers are stopped before the internal servers to ensure any RPCs accepted by the externals servers can still complete their requests to the internal servers. This is important for hooks calling back to Gitaly.

func (*GitalyServerFactory) New

func (s *GitalyServerFactory) New(external, secure bool, opts ...Option) (*grpc.Server, error)

New returns a GRPC server instance with a set of interceptors configured.

func (*GitalyServerFactory) Stop

func (s *GitalyServerFactory) Stop()

Stop immediately stops all servers created by the GitalyServerFactory.

type Option

type Option func(*serverConfig)

Option is an option that can be passed to `New()`.

func WithStreamInterceptor

func WithStreamInterceptor(interceptor grpc.StreamServerInterceptor) Option

WithStreamInterceptor adds another interceptor that shall be executed for streaming RPC calls.

func WithUnaryInterceptor

func WithUnaryInterceptor(interceptor grpc.UnaryServerInterceptor) Option

WithUnaryInterceptor adds another interceptor that shall be executed for unary RPC calls.

type TransactionMiddleware added in v16.6.0

type TransactionMiddleware struct {
	// UnaryInterceptor is the unary RPC interceptor that handles transaction logic.
	UnaryInterceptor grpc.UnaryServerInterceptor
	// StreamInterceptor is the stream RPC interceptor that handles transaction logic.
	StreamInterceptor grpc.StreamServerInterceptor
}

TransactionMiddleware collects transaction middleware into a single struct that can be provided to enable transactions.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL