config

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2022 License: Apache-2.0 Imports: 4 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option struct {
	// network opts
	Timeout    time.Duration
	BufferSize uint32

	// service opts
	Location  string
	Protocol  string
	CodecType constant.CodecType
	//SerializerTypeInWrapper  is used in pbWrapperCodec, to write serializeType field, if empty, use Option.CodecType as default
	SerializerTypeInWrapper string

	// triple header opts
	HeaderGroup      string
	HeaderAppVersion string

	// grpc opts
	GRPCMaxCallSendMsgSize   int
	GRPCMaxServerSendMsgSize int
	GRPCMaxCallRecvMsgSize   int
	GRPCMaxServerRecvMsgSize int

	// tracing
	JaegerAddress     string
	JaegerServiceName string
	JaegerUseAgent    bool

	// logger
	Logger loggerInterface.Logger

	// NumWorkers is num of gr in ConnectionPool
	NumWorkers uint32

	// proxy mode for gateway
	ProxyModeEnable bool

	//tls
	CACertFile    string
	TLSCertFile   string
	TLSKeyFile    string
	TLSServerName string
}

triple option

func NewTripleOption

func NewTripleOption(fs ...OptionFunction) *Option

NewTripleOption return Triple Option with given config defined by @fs

func (*Option) Validate

func (o *Option) Validate()

Validate sets empty field to default config

type OptionFunction

type OptionFunction func(o *Option)

nolint

func WithBufferSize

func WithBufferSize(size uint32) OptionFunction

WithBufferSize return OptionFunction with buffer read size of @size

func WithClientTimeout

func WithClientTimeout(timeout time.Duration) OptionFunction

WithClientTimeout return OptionFunction with timeout of @timeout

func WithCodecType

func WithCodecType(serializerType constant.CodecType) OptionFunction

WithCodecType return OptionFunction with target @serializerType, now we support "protobuf" and "hessian2"

func WithGRPCMaxCallRecvMessageSize

func WithGRPCMaxCallRecvMessageSize(maxCallRecvMsgSize int) OptionFunction

func WithGRPCMaxCallSendMessageSize

func WithGRPCMaxCallSendMessageSize(maxCallSendMsgSize int) OptionFunction

func WithGRPCMaxServerRecvMessageSize

func WithGRPCMaxServerRecvMessageSize(maxServerRecvMsgSize int) OptionFunction

func WithGRPCMaxServerSendMessageSize

func WithGRPCMaxServerSendMessageSize(maxServerSendMsgSize int) OptionFunction

func WithHeaderAppVersion

func WithHeaderAppVersion(appVersion string) OptionFunction

WithHeaderAppVersion return OptionFunction with target @appVersion, for example "1.0.0"

func WithHeaderGroup

func WithHeaderGroup(group string) OptionFunction

WithHeaderGroup return OptionFunction with target @group, for example "dubbogo"

func WithJaegerConfig

func WithJaegerConfig(address, serviceName string, useAgent bool) OptionFunction

func WithLocation

func WithLocation(location string) OptionFunction

WithLocation return OptionFunction with target @location, for example "127.0.0.1:20001"

func WithLogger

func WithLogger(logger loggerInterface.Logger) OptionFunction

WithLogger return OptionFunction with target @logger, which must impl triple/pkg/common/logger.Logger the input @logger should be AddCallerSkip(1)

func WithNumWorker

func WithNumWorker(numWorkers uint32) OptionFunction

func WithProtocol

func WithProtocol(protocol string) OptionFunction

WithProtocol return OptionFunction with target @protocol, now we support "tri"

func WithProxyModeEnable

func WithProxyModeEnable(enable bool) OptionFunction

func WithSerializerTypeInWrapper

func WithSerializerTypeInWrapper(name string) OptionFunction

WithSerializerTypeInWrapper return OptionFunction with target @name as SerializerTypeInWrapper

Jump to

Keyboard shortcuts

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