server

package
v2.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Package server implements a gRPC server (and optional REST gateway) implementation that satisfies the PiServiceClient interface requirements, with optional OpenTelemetry metrics and traces.

Index

Constants

View Source
const (
	// The default name to use when using OpenTelemetry components.
	OpenTelemetryPackageIdentifier = "pkg.server"
)

Variables

View Source
var ErrIndexTooLarge = fmt.Errorf("index is too large, must be <= %d", math.MaxInt64)

Functions

This section is empty.

Types

type PiServer

type PiServer struct {
	generated.UnimplementedPiServiceServer
	// contains filtered or unexported fields
}

func NewPiServer

func NewPiServer(options ...PiServerOption) (*PiServer, error)

Create a new piServer and apply any options.

func (*PiServer) GetDigit

Implement the PiService GetDigit RPC method.

func (*PiServer) NewGrpcServer

func (s *PiServer) NewGrpcServer() *grpc.Server

Create a new grpc.Server that is ready to be attached to a net.Listener.

func (*PiServer) NewRestGatewayHandler

func (s *PiServer) NewRestGatewayHandler(ctx context.Context, grpcAddress string) (http.Handler, error)

Create a new REST gateway handler that translates and forwards incoming REST requests to the specified gRPC endpoint address.

func (*PiServer) NewXDSServer

func (s *PiServer) NewXDSServer() (*xds.GRPCServer, error)

Create a new xds.GRPCServer that is ready to be attached to a net.Listener.

type PiServerOption

type PiServerOption func(*PiServer)

Defines the function signature for PiServer options.

func WithAnnotations

func WithAnnotations(annotations map[string]string) PiServerOption

Add the key-value annotations to the server's metadata.

func WithCache

func WithCache(cache cachepkg.Cache) PiServerOption

Use the Cache implementation to store BBPDigits results to avoid recalculation of a digit that has already been calculated.

func WithGRPCServerTransportCredentials

func WithGRPCServerTransportCredentials(serverCredentials credentials.TransportCredentials) PiServerOption

Set the TransportCredentials to use for Pi Service gRPC listener.

func WithLogger

func WithLogger(logger logr.Logger) PiServerOption

Use the supplied logger for the server and pi packages.

func WithRestClientAuthority

func WithRestClientAuthority(restClientAuthority string) PiServerOption

Set the authority string to use for REST-gRPC gateway calls.

func WithRestClientGRPCTransportCredentials

func WithRestClientGRPCTransportCredentials(restClientGRPCCredentials credentials.TransportCredentials) PiServerOption

Set the TransportCredentials to use for Pi Service REST-to-gRPC client.

func WithTags

func WithTags(tags []string) PiServerOption

Add the string tags to the server's metadata.

Jump to

Keyboard shortcuts

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