grpcserver

package
v0.32.10 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GrpcServer

type GrpcServer struct {
	component.Component

	Server *grpc.Server
	// contains filtered or unexported fields
}

GrpcServer wraps `grpc.Server` and allows to manage it using `component.Component` interface. It can be injected into different engines making it possible to use single grpc server for multiple services which live in different modules.

func NewGrpcServer

func NewGrpcServer(log zerolog.Logger,
	grpcListenAddr string,
	grpcServer *grpc.Server,
) *GrpcServer

NewGrpcServer returns a new grpc server.

func (*GrpcServer) GRPCAddress

func (g *GrpcServer) GRPCAddress() net.Addr

GRPCAddress returns the listen address of the GRPC server. Guaranteed to be non-nil after Engine.Ready is closed.

type GrpcServerBuilder

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

GrpcServerBuilder created for separating the creation and starting GrpcServer, cause services need to be registered before the server starts.

func NewGrpcServerBuilder

func NewGrpcServerBuilder(log zerolog.Logger,
	gRPCListenAddr string,
	maxMsgSize uint,
	rpcMetricsEnabled bool,
	apiRateLimits map[string]int,
	apiBurstLimits map[string]int,
	opts ...Option,
) *GrpcServerBuilder

NewGrpcServerBuilder helps to build a new grpc server.

func (*GrpcServerBuilder) Build

func (b *GrpcServerBuilder) Build() *GrpcServer

type Option

type Option func(*GrpcServerBuilder)

func WithStreamInterceptor

func WithStreamInterceptor() Option

WithStreamInterceptor sets the StreamInterceptor option to grpc server.

func WithTransportCredentials

func WithTransportCredentials(transportCredentials credentials.TransportCredentials) Option

WithTransportCredentials sets the transport credentials parameters for a grpc server builder.

Jump to

Keyboard shortcuts

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