options

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: May 21, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClientOptions

func NewClientOptions(opts ...ClientOption) (*[]grpc.DialOption, error)

func NewServerOptions

func NewServerOptions(opts ...ServerOption) []grpc.UnaryServerInterceptor

Types

type ClientOption

type ClientOption interface {
	// contains filtered or unexported methods
}

func WithClientTracing

func WithClientTracing(tp *sdktrace.TracerProvider) ClientOption

func WithClientValidator added in v0.0.2

func WithClientValidator(all bool) ClientOption

WithClientValidator validate fields, all==true return all fields error, otherwise return first error

func WithEtcdDiscovery

func WithEtcdDiscovery(conf clientv3.Config, serviceDesc grpc.ServiceDesc) ClientOption

func WithInsecure

func WithInsecure() ClientOption

func WithRRLB

func WithRRLB() ClientOption

round_robin load balancing policy

func WithRetry

func WithRetry(mc ...MethodConfig) ClientOption

type MethodConfig

type MethodConfig struct {
	Name        []MethodName `json:"name"`
	RetryPolicy RetryPolicy  `json:"retryPolicy"`
}

type MethodName

type MethodName struct {
	Service string `json:"service"`
	Method  string `json:"method"`
}

type RetryPolicy

type RetryPolicy struct {
	MaxAttempts          int      `json:"MaxAttempts"`
	MaxBackoff           string   `json:"MaxBackoff"`
	InitialBackoff       string   `json:"InitialBackoff"`
	BackoffMultiplier    int      `json:"BackoffMultiplier"`
	RetryableStatusCodes []string `json:"RetryableStatusCodes"`
}

type ServerOption

type ServerOption interface {
	// contains filtered or unexported methods
}

func WithDebug

func WithDebug(flag bool) ServerOption

func WithServerTracing

func WithServerTracing(tp *sdktrace.TracerProvider) ServerOption

func WithServerValidator added in v0.0.2

func WithServerValidator(all bool) ServerOption

WithServerValidator validate fields, all==true return all fields error, otherwise return first error

func WithTBRL

func WithTBRL(pairs ...ratelimit.TBPair) ServerOption

WithTBRL TokenBucketRateLimiter

type ServiceConfig

type ServiceConfig struct {
	Methodconfig        []MethodConfig `json:"methodConfig,omitempty"`
	LoadBalancingPolicy string         `json:"loadBalancingPolicy,omitempty"`
}

Jump to

Keyboard shortcuts

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