grpc

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package grpc provides a gRPC server which implements the app.Runtime interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Runtime

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

Runtime is a bedrock.Runtime for running a gRPC service.

func NewRuntime

func NewRuntime(opts ...RuntimeOption) *Runtime

NewRuntime returns a fully initialized gRPC Runtime.

func (*Runtime) Run

func (rt *Runtime) Run(ctx context.Context) error

Run implements the app.Runtime interface.

type RuntimeOption

type RuntimeOption func(*runtimeOptions)

RuntimeOption are options for configuring the gRPC runtime.

func ChainStreamInterceptor added in v0.4.2

func ChainStreamInterceptor(interceptors ...grpc.StreamServerInterceptor) RuntimeOption

ChainStreamInterceptor configires the gRPC server for multiple server interceptors, please refer to grpc.ChainStreamInterceptor for more information

func ChainUnaryInterceptor added in v0.4.2

func ChainUnaryInterceptor(interceptors ...grpc.UnaryServerInterceptor) RuntimeOption

ChainUnaryInterceptor configures the gRPC server for multiple unary interceptors, please refer to grpc.ChainUnaryInterceptor for more information

func ListenOnPort

func ListenOnPort(port uint) RuntimeOption

ListenOnPort will configure the HTTP server to listen on the given port.

Default port is 8080.

func LogHandler

func LogHandler(h slog.Handler) RuntimeOption

LogHandler configures the underlying slog.Handler.

func Service

func Service(f func(*grpc.Server), opts ...ServiceOption) RuntimeOption

Service registers a gRPC service with the underlying gRPC server.

func StreamInterceptor added in v0.4.2

func StreamInterceptor(i grpc.StreamServerInterceptor) RuntimeOption

StreamInterceptor configures the gRPC server for one server interceptor, please refer to grpc.StreamInterceptor for more information

func TransportCredentials

func TransportCredentials(tc credentials.TransportCredentials) RuntimeOption

TransportCredentials configures the gRPC transport credentials which the gRPC server uses.

func UnaryInterceptor added in v0.4.2

func UnaryInterceptor(f grpc.UnaryServerInterceptor) RuntimeOption

UnaryInterceptor configures the gRPC server for one unary interceptors, please refer to grpc.UnaryInterceptor for more information

type ServiceOption

type ServiceOption func(*serviceOptions)

ServiceOption are options for configuring the gRPC health service.

func Readiness

func Readiness(m health.Metric) ServiceOption

Readiness configures the health readiness metric for the gRPC service.

func ServiceName

func ServiceName(name string) ServiceOption

ServiceName configures the service name which will be reported by the gRPC health service.

Jump to

Keyboard shortcuts

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