praefect

package
v1.80.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2020 License: MIT Imports: 38 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

This section is empty.

Functions

func GetBuildTime added in v1.53.0

func GetBuildTime() string

GetBuildTime returns the time at which the build took place

func GetVersion added in v1.53.0

func GetVersion() string

GetVersion returns the semver compatible version number

func GetVersionString added in v1.53.0

func GetVersionString() string

GetVersionString returns a standard version header

func WithLatencyMetric added in v1.79.0

func WithLatencyMetric(h metrics.Histogram) func(*ReplMgr)

WithLatencyMetric is an option to set the queue size prometheus metric

func WithQueueMetric added in v1.79.0

func WithQueueMetric(g metrics.Gauge) func(*ReplMgr)

WithQueueMetric is an option to set the queue size prometheus metric

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 NewCoordinator added in v1.34.0

func NewCoordinator(l *logrus.Entry, ds datastore.Datastore, clientConnections *conn.ClientConnections, conf config.Config, fileDescriptors ...*descriptor.FileDescriptorProto) *Coordinator

NewCoordinator returns a new Coordinator that utilizes the provided logger

func (*Coordinator) FailoverRotation added in v1.56.0

func (c *Coordinator) FailoverRotation()

FailoverRotation waits for the SIGUSR1 signal, then promotes the next secondary to be primary

func (*Coordinator) RegisterProtos added in v1.35.1

func (c *Coordinator) RegisterProtos(protos ...*descriptor.FileDescriptorProto) error

RegisterProtos allows coordinator to register new protos on the fly

type ReplMgr added in v1.34.0

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

ReplMgr is a replication manager for handling replication jobs

func NewReplMgr added in v1.34.0

func NewReplMgr(targetNode string, log *logrus.Entry, datastore datastore.Datastore, c *conn.ClientConnections, opts ...ReplMgrOpt) ReplMgr

NewReplMgr initializes a replication manager with the provided dependencies and options

func (ReplMgr) ProcessBacklog added in v1.34.0

func (r ReplMgr) ProcessBacklog(ctx context.Context) error

ProcessBacklog will process queued jobs. It will block while processing jobs.

func (ReplMgr) ScheduleReplication added in v1.34.0

func (r ReplMgr) ScheduleReplication(ctx context.Context, repo models.Repository) error

ScheduleReplication will store a replication job in the datastore for later execution. It filters out projects that are not whitelisted. TODO: add a parameter to delay replication

type ReplMgrOpt added in v1.34.0

type ReplMgrOpt func(*ReplMgr)

ReplMgrOpt allows a replicator to be configured with additional options

func WithReplicator added in v1.34.0

func WithReplicator(r Replicator) ReplMgrOpt

WithReplicator overrides the default replicator

func WithWhitelist added in v1.34.0

func WithWhitelist(whitelistedRepos []string) ReplMgrOpt

WithWhitelist will configure a whitelist for repos to allow replication

type Replicator added in v1.34.0

type Replicator interface {
	// Replicate propagates changes from the source to the target
	Replicate(ctx context.Context, job datastore.ReplJob, source, target *grpc.ClientConn) error
	// Destroy will remove the target repo on the specified target connection
	Destroy(ctx context.Context, job datastore.ReplJob, target *grpc.ClientConn) error
}

Replicator performs the actual replication logic between two nodes

type Server

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

Server is a praefect server

func NewServer

func NewServer(c *Coordinator, repl ReplMgr, grpcOpts []grpc.ServerOption, l *logrus.Entry, clientConnections *conn.ClientConnections, conf config.Config) *Server

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

func (*Server) GracefulStop added in v1.75.0

func (srv *Server) GracefulStop()

GracefulStop stops the praefect server gracefully

func (*Server) RegisterServices added in v1.75.0

func (srv *Server) RegisterServices()

RegisterServices will register any services praefect needs to handle rpcs on its own

func (*Server) Serve added in v1.75.0

func (srv *Server) Serve(l net.Listener, secure bool) error

Serve starts serving requests from the listener

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) Stop added in v1.75.0

func (srv *Server) Stop()

Stop stops the praefect server

Directories

Path Synopsis
Package datastore provides data models and datastore persistence abstractions for tracking the state of repository replicas.
Package datastore provides data models and datastore persistence abstractions for tracking the state of repository replicas.
grpc-proxy
proxy
Package proxy provides a reverse proxy handler for gRPC.
Package proxy provides a reverse proxy handler for gRPC.
service

Jump to

Keyboard shortcuts

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