grpc

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2022 License: MIT Imports: 27 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MetadataClientAPIVersionKey = "client-api-version"
)

Functions

func Dial added in v1.6.0

func Dial(ctx context.Context, opts ...ClientOption) (*grpc.ClientConn, error)

Dial

func DialInsecure added in v1.6.0

func DialInsecure(ctx context.Context, opts ...ClientOption) (*grpc.ClientConn, error)

Types

type ClientOption added in v1.6.0

type ClientOption func(o *clientOptions)

ClientOption is a gRPC client option.

func WithDiscovery added in v1.6.0

func WithDiscovery(d registry.Discovery) ClientOption

func WithEndpoint added in v1.6.0

func WithEndpoint(endpoint string) ClientOption

WithEndpoint with a endpoint.

func WithGzip added in v1.6.0

func WithGzip() ClientOption

WithGzip enable gzip.

func WithLog added in v1.6.0

func WithLog() ClientOption

WithLog enable log.

func WithMetric added in v1.6.0

func WithMetric() ClientOption

WithMetric enable metric.

func WithOptions added in v1.6.0

func WithOptions(opts ...grpc.DialOption) ClientOption

WithOptions with gRPC dial option.

func WithTimeout added in v1.6.0

func WithTimeout(timeout time.Duration) ClientOption

WithTimeout with a client timeout.

func WithUnaryInterceptor added in v1.6.0

func WithUnaryInterceptor(inter ...grpc.UnaryClientInterceptor) ClientOption

WithUnaryInterceptor with unary client interceptor.

func WithoutRetry added in v1.6.0

func WithoutRetry() ClientOption

WithoutRetry disable retry.

type Server

type Server struct {
	*grpc.Server

	// TracerOptions are options for OpenTelemetry gRPC interceptor.
	TracerOptions []otelgrpc.Option
	// contains filtered or unexported fields
}

Server is a gRPC server wrapper. nolint

func NewServer

func NewServer(opts ...ServerOption) *Server

NewServer creates a gRPC server by options.

func (*Server) Endpoint

func (s *Server) Endpoint() (*url.URL, error)

Endpoint return a real address to registry endpoint. examples:

grpc://127.0.0.1:9090

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

Start start the gRPC server.

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

Stop stop the gRPC server.

type ServerOption

type ServerOption func(o *Server)

ServerOption is gRPC server option.

func Address

func Address(addr string) ServerOption

Address with server address.

func EnableLog added in v1.6.0

func EnableLog() ServerOption

EnableLog enable log for server.

func EnableTracing added in v1.6.0

func EnableTracing() ServerOption

EnableTracing enable tracing.

func Network

func Network(network string) ServerOption

Network with server network.

func Options

func Options(opts ...grpc.ServerOption) ServerOption

Options with grpc options.

func Timeout

func Timeout(timeout time.Duration) ServerOption

Timeout with server timeout.

func UnaryInterceptor

func UnaryInterceptor(in ...grpc.UnaryServerInterceptor) ServerOption

UnaryInterceptor returns a ServerOption that sets the UnaryServerInterceptor for the server.

Directories

Path Synopsis
resolver

Jump to

Keyboard shortcuts

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