grpcserver

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GRPCLogger

func GRPCLogger(log *slog.Logger) grpclog.LoggerV2

func Module

func Module(opts ...Option) app.Module

Module provides the *grpc.Server a service registers on, and runs it.

Types

type Addr

type Addr string

type Config

type Config struct {
	Addr string `config:"addr" validate:"required"`

	// GracePeriod bounds GracefulStop, which waits on in-flight calls forever.
	// It has to be under the drain budget the app publishes.
	GracePeriod time.Duration `config:"grace_period" validate:"required"`

	Reflection bool `config:"reflection"`

	Health bool `config:"health"`

	// MaxReceiveBytes caps one received message, and takes a binary unit such
	// as "16MiB". The server answers a larger message with ResourceExhausted.
	MaxReceiveBytes config.Bytes `config:"max_receive_bytes" validate:"min=1"`
}

type Option

type Option func(*options)

func WithAddr added in v0.5.0

func WithAddr(addr string) Option

WithAddr replaces the default of addr. A configured addr still replaces this value. An empty addr keeps the default.

func WithMaxReceiveBytes added in v0.5.0

func WithMaxReceiveBytes(n config.Bytes) Option

WithMaxReceiveBytes replaces the default of max_receive_bytes. A configured max_receive_bytes still replaces this value. Zero keeps the default.

func WithStreamInterceptors added in v0.5.0

func WithStreamInterceptors(interceptors ...StreamInterceptor) Option

WithStreamInterceptors chains the interceptors in the order given, outermost first.

func WithUnaryInterceptors

func WithUnaryInterceptors(interceptors ...UnaryInterceptor) Option

WithUnaryInterceptors chains the interceptors in the order given, outermost first.

type StreamInterceptor added in v0.5.0

type StreamInterceptor func(do.Injector) (grpc.StreamServerInterceptor, error)

type UnaryInterceptor

type UnaryInterceptor func(do.Injector) (grpc.UnaryServerInterceptor, error)

Jump to

Keyboard shortcuts

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