praefect

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package praefect is a Gitaly reverse proxy for transparently routing gRPC calls to a set of Gitaly services.

Index

Constants

This section is empty.

Variables

View Source
var ErrStorageLocExists = errors.New("storage location already registered")

ErrStorageLocExists indicates a storage location has already been registered in the proxy for a downstream Gitaly node

Functions

This section is empty.

Types

type Coordinator

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

Coordinator takes care of directing client requests to the appropriate downstream server. The coordinator is thread safe; concurrent calls to register nodes are safe.

func (*Coordinator) RegisterNode

func (c *Coordinator) RegisterNode(storageLoc string, node *grpc.ClientConn)

RegisterNode will direct traffic to the supplied downstream connection when the storage location is encountered.

TODO: Coordinator probably needs to handle dialing, or another entity needs to handle dialing to ensure keep alives and redialing logic exist for when downstream connections are severed.

type Logger

type Logger interface {
	Debugf(format string, args ...interface{})
}

Logger is a simple interface that allows loggers to be dependency injected into the praefect server

type Server

type Server struct {
	*Coordinator
	// contains filtered or unexported fields
}

Server is a praefect server

func NewServer

func NewServer(grpcOpts []grpc.ServerOption, l Logger) *Server

NewServer returns an initialized praefect gPRC proxy server configured with the provided gRPC server options

func (*Server) Shutdown

func (srv *Server) Shutdown(ctx context.Context) error

Shutdown will attempt a graceful shutdown of the grpc server. If unable to gracefully shutdown within the context deadline, it will then forcefully shutdown the server and return a context cancellation error.

func (*Server) Start

func (srv *Server) Start(lis net.Listener) error

Start will start the praefect gRPC proxy server listening at the provided listener. Function will block until the server is stopped or an unrecoverable error occurs.

Jump to

Keyboard shortcuts

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