grpc

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ProvidersGRPC = wire.NewSet(
		NewGRPCServer,
	)
)

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