grpc

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: AGPL-3.0 Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoggingInterceptor

func LoggingInterceptor(logger logging.Logger) grpc.UnaryServerInterceptor

func RegisterGRPCServer

func RegisterGRPCServer(i do.Injector)

RegisterGRPCServer registers a *Server with the injector. Prerequisites: []grpc.UnaryServerInterceptor, []grpc.StreamServerInterceptor, and []RegistrationFunc must be registered in the injector before calling this.

Types

type Config

type Config struct {
	HTTPSCertificateFile  string `env:"TLS_CERTIFICATE_FILEPATH"     json:"tlsCertificate,omitempty"`
	TLSCertificateKeyFile string `env:"TLS_CERTIFICATE_KEY_FILEPATH" json:"tlsCertificateKey,omitempty"`
	Port                  uint16 `env:"PORT"                         json:"port"`
}

type RegistrationFunc

type RegistrationFunc func(*grpc.Server)

RegistrationFunc is i.e. protobuf.RegisterSomeExampleServiceServer(grpcServer, &exampleServiceServerImpl{}).

type Server

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

func NewGRPCServer

func NewGRPCServer(
	cfg *Config,
	logger logging.Logger,
	tracerProvider tracing.TracerProvider,
	unaryServerInterceptors []grpc.UnaryServerInterceptor,
	streamServerInterceptors []grpc.StreamServerInterceptor,
	registrationFunctions ...RegistrationFunc,
) (*Server, error)

func (*Server) Serve

func (s *Server) Serve(ctx context.Context)

Serve serves GRPC traffic.

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context)

Shutdown shuts down the server. Call with a context that has sufficient timeout to allow in-flight spans to be flushed to the collector.

Jump to

Keyboard shortcuts

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