grpc

package
v1.10.5 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PortConfigKey        = "grpc-port"
	GracePeriodConfigKey = "grpc-grace-period"
)
View Source
const (
	HealthUnknown    = 0
	HealthServing    = 1
	HealthNotServing = 2
)
View Source
const DefaultGracePeriod = 3 * time.Second
View Source
const DefaultHealthEnabled = true
View Source
const DefaultLoggingInterceptor = true
View Source
const DefaultPort = "50051"
View Source
const DefaultPrometheusInterceptor = true
View Source
const DefaultRequestIdInterceptor = true

Variables

This section is empty.

Functions

func Flags

func Flags() *pflag.FlagSet

Flags is a convenience function to quickly add the gRPC server options as CLI flags Implements the cli.FlagProvider type

Types

type BasicHealthChecker added in v1.1.0

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

func NewBasicHealthChecker added in v1.1.0

func NewBasicHealthChecker(opts ...Option) *BasicHealthChecker

func (*BasicHealthChecker) Check added in v1.1.0

func (*BasicHealthChecker) Watch added in v1.1.0

type MongodbHealthChecker added in v1.0.0

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

func NewMongoDBHealthChecker added in v1.0.0

func NewMongoDBHealthChecker(db *mongo.Client, opts ...Option) *MongodbHealthChecker

func (*MongodbHealthChecker) Check added in v1.0.0

func (*MongodbHealthChecker) Watch added in v1.0.0

type MySQLHealthChecker added in v1.0.0

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

func NewMySQLHealthChecker added in v1.0.0

func NewMySQLHealthChecker(db *sqlx.DB, opts ...Option) *MySQLHealthChecker

func (*MySQLHealthChecker) Check added in v1.0.0

func (*MySQLHealthChecker) Watch added in v1.0.0

type Option

type Option func(*Options)

func DisableHealthServer

func DisableHealthServer() Option

func DisableLoggingInterceptor

func DisableLoggingInterceptor() Option

func DisablePrometheusInterceptor

func DisablePrometheusInterceptor() Option

func DisableRequestIdInterceptor

func DisableRequestIdInterceptor() Option

func Name

func Name(name string) Option

func Port

func Port(addr string) Option

func ShutdownGracePeriod

func ShutdownGracePeriod(duration time.Duration) Option

type Options

type Options struct {
	Port                string
	Name                string
	ShutdownGracePeriod time.Duration
	HealthServerEnabled bool
	// contains filtered or unexported fields
}

type Server

type Server interface {
	ListenAndServe(ctx context.Context, wg *sync.WaitGroup, healthServer grpc_health_v1.HealthServer)
	Server() *grpc.Server
}

func NewServer

func NewServer(opts ...Option) Server

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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