config

package
v3.0.0-rc4-1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2021 License: Apache-2.0 Imports: 59 Imported by: 131

Documentation

Index

Constants

View Source
const (
	MaxWheelTimeSpan = 900e9 // 900s, 15 minute
)

Variables

View Source
var (
	// ShutdownSignals receives shutdown signals to process
	ShutdownSignals = []os.Signal{
		os.Interrupt, os.Kill, syscall.SIGKILL, syscall.SIGSTOP,
		syscall.SIGHUP, syscall.SIGINT, syscall.SIGQUIT, syscall.SIGILL, syscall.SIGTRAP,
		syscall.SIGABRT, syscall.SIGSYS, syscall.SIGTERM,
	}

	// DumpHeapShutdownSignals receives shutdown signals to process
	DumpHeapShutdownSignals = []os.Signal{
		syscall.SIGQUIT, syscall.SIGILL,
		syscall.SIGTRAP, syscall.SIGABRT, syscall.SIGSYS,
	}
)

Functions

func BeforeShutdown

func BeforeShutdown()

BeforeShutdown provides processing flow before shutdown

func GetCallback

func GetCallback(name string) func(response common.CallbackResponse)

GetCallback gets CallbackResponse by @name

func GetClientTlsConfigBuilder

func GetClientTlsConfigBuilder() getty.TlsConfigBuilder

func GetConfigResolver

func GetConfigResolver(conf *loaderConf) *koanf.Koanf

GetConfigResolver get config resolver

func GetConsumerService

func GetConsumerService(name string) common.RPCService

GetConsumerService gets ConsumerService by @name

func GetConsumerServiceByInterfaceName

func GetConsumerServiceByInterfaceName(interfaceName string) common.RPCService

GetConsumerServiceByInterfaceName is used by pb serialization

func GetProtocolsInstance

func GetProtocolsInstance() map[string]*ProtocolConfig

func GetProviderService

func GetProviderService(name string) common.RPCService

GetProviderService gets ProviderService by @name

func GetRPCService

func GetRPCService(name string) common.RPCService

GetRPCService get rpc service for consumer

func GetServerTlsConfigBuilder

func GetServerTlsConfigBuilder() getty.TlsConfigBuilder

func GracefulShutdownInit

func GracefulShutdownInit()

GracefulShutdownInit todo GracefulShutdownInit in 3.0 should be discusesed.

func IsProvider

func IsProvider() bool

func Load

func Load(opts ...LoaderConfOption) error

func NewLoaderConf

func NewLoaderConf(opts ...LoaderConfOption) *loaderConf

func RPCService

func RPCService(service common.RPCService)

RPCService create rpc service for consumer

func SetClientTlsConfigBuilder

func SetClientTlsConfigBuilder(configBuilder getty.TlsConfigBuilder)

func SetConsumerConfig

func SetConsumerConfig(c ConsumerConfig)

SetConsumerConfig sets consumerConfig by @c

func SetConsumerService

func SetConsumerService(service common.RPCService)

SetConsumerService is called by init() of implement of RPCService

func SetConsumerServiceByInterfaceName

func SetConsumerServiceByInterfaceName(interfaceName string, srv common.RPCService)

SetConsumerServiceByInterfaceName is used by pb serialization

func SetProviderService

func SetProviderService(service common.RPCService)

SetProviderService is called by init() of implement of RPCService

func SetRootConfig

func SetRootConfig(r RootConfig)

func SetServerTlsConfigBuilder

func SetServerTlsConfigBuilder(configBuilder getty.TlsConfigBuilder)

Types

type ApplicationConfig

type ApplicationConfig struct {
	Organization string `default:"dubbo-go" yaml:"organization" json:"organization,omitempty" property:"organization"`
	Name         string `default:"dubbo.io" yaml:"name" json:"name,omitempty" property:"name"`
	Module       string `default:"sample" yaml:"module" json:"module,omitempty" property:"module"`
	Version      string `default:"3.0.0" yaml:"version" json:"version,omitempty" property:"version"`
	Owner        string `default:"dubbo-go" yaml:"owner" json:"owner,omitempty" property:"owner"`
	Environment  string `default:"dev" yaml:"environment" json:"environment,omitempty" property:"environment"`
	// the metadata type. remote or local
	MetadataType string `default:"local" yaml:"metadata-type" json:"metadataType,omitempty" property:"metadataType"`
}

ApplicationConfig is a configuration for current applicationConfig, whether the applicationConfig is a provider or a consumer

func GetApplicationConfig

func GetApplicationConfig() *ApplicationConfig

func (*ApplicationConfig) Init

func (ac *ApplicationConfig) Init() error

Init application config and set default value

func (ApplicationConfig) Prefix

func (ApplicationConfig) Prefix() string

Prefix dubbo.application

type ApplicationConfigBuilder

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

func NewApplicationConfigBuilder

func NewApplicationConfigBuilder() *ApplicationConfigBuilder

func (*ApplicationConfigBuilder) Build

func (*ApplicationConfigBuilder) SetEnvironment

func (acb *ApplicationConfigBuilder) SetEnvironment(environment string) *ApplicationConfigBuilder

func (*ApplicationConfigBuilder) SetMetadataType

func (acb *ApplicationConfigBuilder) SetMetadataType(metadataType string) *ApplicationConfigBuilder

func (*ApplicationConfigBuilder) SetModule

func (*ApplicationConfigBuilder) SetName

func (*ApplicationConfigBuilder) SetOrganization

func (acb *ApplicationConfigBuilder) SetOrganization(organization string) *ApplicationConfigBuilder

func (*ApplicationConfigBuilder) SetOwner

func (*ApplicationConfigBuilder) SetVersion

func (acb *ApplicationConfigBuilder) SetVersion(version string) *ApplicationConfigBuilder

type BoolMatch

type BoolMatch struct {
	Exact bool `yaml:"exact" json:"exact"`
}

nolint

type CenterConfig

type CenterConfig struct {
	Protocol  string            `validate:"required" yaml:"protocol"  json:"protocol,omitempty"`
	Address   string            `validate:"required" yaml:"address" json:"address,omitempty"`
	DataId    string            `yaml:"data-id" json:"data-id,omitempty"`
	Cluster   string            `yaml:"cluster" json:"cluster,omitempty"`
	Group     string            `yaml:"group" json:"group,omitempty"`
	Username  string            `yaml:"username" json:"username,omitempty"`
	Password  string            `yaml:"password" json:"password,omitempty"`
	Namespace string            `yaml:"namespace"  json:"namespace,omitempty"`
	AppID     string            `default:"dubbo" yaml:"app-id"  json:"app-id,omitempty"`
	Timeout   string            `default:"10s" yaml:"timeout"  json:"timeout,omitempty"`
	Params    map[string]string `yaml:"params"  json:"parameters,omitempty"`
}

CenterConfig is configuration for config center

ConfigCenter also introduced concepts of namespace and group to better manage Key-Value pairs by group, those configs are already built-in in many professional third-party configuration centers. In most cases, namespace is used to isolate different tenants, while group is used to divide the key set from one tenant into groups.

CenterConfig has currently supported Zookeeper, Nacos, Etcd, Consul, Apollo

func (*CenterConfig) CreateDynamicConfiguration

func (c *CenterConfig) CreateDynamicConfiguration() (config_center.DynamicConfiguration, error)

func (*CenterConfig) GetDynamicConfiguration

func (c *CenterConfig) GetDynamicConfiguration() (config_center.DynamicConfiguration, error)

func (*CenterConfig) GetUrlMap

func (c *CenterConfig) GetUrlMap() url.Values

GetUrlMap gets url map from ConfigCenterConfig

func (*CenterConfig) Init

func (c *CenterConfig) Init(rc *RootConfig) error

func (CenterConfig) Prefix

func (CenterConfig) Prefix() string

Prefix dubbo.config-center

type ConfigCenterConfigBuilder

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

func NewConfigCenterConfigBuilder

func NewConfigCenterConfigBuilder() *ConfigCenterConfigBuilder

func (*ConfigCenterConfigBuilder) Build

func (*ConfigCenterConfigBuilder) SetAddress

func (*ConfigCenterConfigBuilder) SetDataID

func (*ConfigCenterConfigBuilder) SetGroup

func (*ConfigCenterConfigBuilder) SetNamespace

func (ccb *ConfigCenterConfigBuilder) SetNamespace(namespace string) *ConfigCenterConfigBuilder

func (*ConfigCenterConfigBuilder) SetPassword

func (ccb *ConfigCenterConfigBuilder) SetPassword(password string) *ConfigCenterConfigBuilder

func (*ConfigCenterConfigBuilder) SetProtocol

func (ccb *ConfigCenterConfigBuilder) SetProtocol(protocol string) *ConfigCenterConfigBuilder

func (*ConfigCenterConfigBuilder) SetUserName

func (ccb *ConfigCenterConfigBuilder) SetUserName(userName string) *ConfigCenterConfigBuilder

type ConsumerConfig

type ConsumerConfig struct {
	Filter string `yaml:"filter" json:"filter,omitempty" property:"filter"`
	// support string
	RegistryIDs []string `yaml:"registry-ids" json:"registry-ids,omitempty" property:"registry-ids"`

	RequestTimeout string `default:"3s" yaml:"request-timeout" json:"request-timeout,omitempty" property:"request-timeout"`
	ProxyFactory   string `default:"default" yaml:"proxy" json:"proxy,omitempty" property:"proxy"`
	Check          bool   `yaml:"check" json:"check,omitempty" property:"check"`

	References map[string]*ReferenceConfig `yaml:"references" json:"references,omitempty" property:"references"`

	FilterConf                     interface{} `yaml:"filter-conf" json:"filter-conf,omitempty" property:"filter-conf"`
	MaxWaitTimeForServiceDiscovery string      `` /* 155-byte string literal not displayed */
	// contains filtered or unexported fields
}

ConsumerConfig is Consumer default configuration

func GetConsumerConfig

func GetConsumerConfig() *ConsumerConfig

func (*ConsumerConfig) Init

func (cc *ConsumerConfig) Init(rc *RootConfig) error

func (*ConsumerConfig) Load

func (cc *ConsumerConfig) Load()

func (ConsumerConfig) Prefix

func (ConsumerConfig) Prefix() string

Prefix dubbo.consumer

type ConsumerConfigBuilder

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

func NewConsumerConfigBuilder

func NewConsumerConfigBuilder() *ConsumerConfigBuilder

func (*ConsumerConfigBuilder) AddReference

func (ccb *ConsumerConfigBuilder) AddReference(referenceKey string, referenceConfig *ReferenceConfig) *ConsumerConfigBuilder

func (*ConsumerConfigBuilder) Build

func (ccb *ConsumerConfigBuilder) Build() *ConsumerConfig

func (*ConsumerConfigBuilder) SetCheck

func (ccb *ConsumerConfigBuilder) SetCheck(check bool) *ConsumerConfigBuilder

func (*ConsumerConfigBuilder) SetFilter

func (ccb *ConsumerConfigBuilder) SetFilter(filter string) *ConsumerConfigBuilder

func (*ConsumerConfigBuilder) SetFilterConf

func (ccb *ConsumerConfigBuilder) SetFilterConf(filterConf interface{}) *ConsumerConfigBuilder

func (*ConsumerConfigBuilder) SetMaxWaitTimeForServiceDiscovery

func (ccb *ConsumerConfigBuilder) SetMaxWaitTimeForServiceDiscovery(maxWaitTimeForServiceDiscovery string) *ConsumerConfigBuilder

func (*ConsumerConfigBuilder) SetProxyFactory

func (ccb *ConsumerConfigBuilder) SetProxyFactory(proxyFactory string) *ConsumerConfigBuilder

func (*ConsumerConfigBuilder) SetReferences

func (ccb *ConsumerConfigBuilder) SetReferences(references map[string]*ReferenceConfig) *ConsumerConfigBuilder

func (*ConsumerConfigBuilder) SetRegistryIDs

func (ccb *ConsumerConfigBuilder) SetRegistryIDs(RegistryIDs ...string) *ConsumerConfigBuilder

func (*ConsumerConfigBuilder) SetRequestTimeout

func (ccb *ConsumerConfigBuilder) SetRequestTimeout(requestTimeout string) *ConsumerConfigBuilder

func (*ConsumerConfigBuilder) SetRootConfig

func (ccb *ConsumerConfigBuilder) SetRootConfig(rootConfig *RootConfig) *ConsumerConfigBuilder

type DestinationRuleConfig

type DestinationRuleConfig struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	YamlAPIVersion    string              `yaml:"apiVersion" `
	YamlKind          string              `yaml:"kind" `
	MetaData          MetaDataStruct      `yaml:"metadata"`
	Spec              DestinationRuleSpec `yaml:"spec" json:"spec"`
}

DestinationRuleConfig Definition

func (*DestinationRuleConfig) DeepCopyObject

func (drc *DestinationRuleConfig) DeepCopyObject() runtime.Object

nolint

type DestinationRuleConfigList

type DestinationRuleConfigList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []DestinationRuleConfig `json:"items"`
}

nolint

func (*DestinationRuleConfigList) DeepCopyObject

func (drc *DestinationRuleConfigList) DeepCopyObject() runtime.Object

nolint

type DestinationRuleSpec

type DestinationRuleSpec struct {
	Host    string                  `yaml:"host" json:"host"`
	SubSets []DestinationRuleSubSet `yaml:"subsets" json:"subsets"`
}

nolint

type DestinationRuleSpecList

type DestinationRuleSpecList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []DestinationRuleSpec `json:"items"`
}

nolint

type DestinationRuleSubSet

type DestinationRuleSubSet struct {
	Name   string            `yaml:"name" json:"name"`
	Labels map[string]string `yaml:"labels" json:"labels"`
}

nolint

type DoubleMatch

type DoubleMatch struct {
	Exact float64           `yaml:"exact" json:"exact"`
	Range *DoubleRangeMatch `yaml:"range" json:"range"`
	Mode  float64           `yaml:"mode" json:"mode"`
}

nolint

type DoubleRangeMatch

type DoubleRangeMatch struct {
	Start float64 `yaml:"start" json:"start"`
	End   float64 `yaml:"end" json:"end"`
}

nolint

type DubboAttachmentMatch

type DubboAttachmentMatch struct {
	EagleeyeContext map[string]*StringMatch `yaml:"eagleeyecontext" json:"eagleeyecontext"`
	DubboContext    map[string]*StringMatch `yaml:"dubbocontext" json:"dubbocontext"`
}

nolint

type DubboDestination

type DubboDestination struct {
	Destination RouterDest `yaml:"destination" json:"destination"`
}

nolint

type DubboMatchRequest

type DubboMatchRequest struct {
	Name         string                  `yaml:"name" json:"name"`
	Method       *DubboMethodMatch       `yaml:"method" json:"method"`
	SourceLabels map[string]string       `yaml:"sourceLabels" json:"sourceLabels"`
	Attachment   *DubboAttachmentMatch   `yaml:"attachments" json:"attachments"`
	Header       map[string]*StringMatch `yaml:"headers" json:"headers"`
	Threshold    *DoubleMatch            `yaml:"threshold" json:"threshold"`
}

nolint

type DubboMethodArg

type DubboMethodArg struct {
	Index     uint32           `yaml:"index" json:"index"`
	Type      string           `yaml:"type" json:"type"`
	StrValue  *ListStringMatch `yaml:"str_value" json:"str_value"`
	NumValue  *ListDoubleMatch `yaml:"num_value" json:"num_value"`
	BoolValue *BoolMatch       `yaml:"bool_value" json:"bool_value"`
}

nolint

type DubboMethodMatch

type DubboMethodMatch struct {
	NameMatch *StringMatch            `yaml:"name_match" json:"name_match"`
	Argc      int                     `yaml:"argc" json:"argc"`
	Args      []*DubboMethodArg       `yaml:"args" json:"args"`
	Argp      []*StringMatch          `yaml:"argp" json:"argp"`
	Headers   map[string]*StringMatch `yaml:"headers" json:"headers"`
}

nolint

type DubboRoute

type DubboRoute struct {
	Name         string              `yaml:"name" json:"name"`
	Services     []*StringMatch      `yaml:"services" json:"service"`
	RouterDetail []*DubboRouteDetail `yaml:"routedetail" json:"routedetail"`
}

nolint

type DubboRouteDetail

type DubboRouteDetail struct {
	Name   string               `yaml:"name" json:"name"`
	Match  []*DubboMatchRequest `yaml:"match" json:"match"`
	Router []*DubboDestination  `yaml:"route" json:"route"`
}

nolint

type EncoderConfig

type EncoderConfig struct {
	MessageKey     string            `default:"message" json:"message-key,omitempty" yaml:"message-key" property:"message-key"`
	LevelKey       string            `default:"level" json:"level-key,omitempty" yaml:"level-key" property:"level-key"`
	TimeKey        string            `default:"time" json:"time-key,omitempty" yaml:"time-key" property:"time-key"`
	NameKey        string            `default:"logger" json:"name-key,omitempty" yaml:"name-key" property:"name-key"`
	CallerKey      string            `default:"caller" json:"caller-key,omitempty" yaml:"caller-key" property:"caller-key"`
	StacktraceKey  string            `default:"stacktrace" json:"stacktrace-key,omitempty" yaml:"stacktrace-key" property:"stacktrace-key"`
	EncodeLevel    string            `default:"capitalColor" json:"level-encoder" yaml:"level-encoder" property:"level-encoder"`
	EncodeTime     string            `default:"iso8601" json:"time-encoder" yaml:"time-encoder" property:"time-encoder"`
	EncodeDuration string            `default:"seconds" json:"duration-encoder" yaml:"duration-encoder" property:"duration-encoder"`
	EncodeCaller   string            `default:"short" json:"caller-encoder" yaml:"calle-encoder" property:"caller-encoder"`
	Params         map[string]string `yaml:"params" json:"params,omitempty"`
}

type ListDoubleMatch

type ListDoubleMatch struct {
	Oneof []*DoubleMatch `yaml:"oneof" json:"oneof"`
}

nolint

type ListStringMatch

type ListStringMatch struct {
	Oneof []*StringMatch `yaml:"oneof" json:"oneof"`
}

nolint

type LoaderConfOption

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

func WithDelim

func WithDelim(delim string) LoaderConfOption

func WithGenre

func WithGenre(genre string) LoaderConfOption

WithGenre set load config genre

func WithPath

func WithPath(path string) LoaderConfOption

WithPath set load config path

func WithRootConfig

func WithRootConfig(rc *RootConfig) LoaderConfOption

type LoggerConfig

type LoggerConfig struct {
	LumberjackConfig *lumberjack.Logger `yaml:"lumberjack-config" json:"lumberjack-config,omitempty" property:"lumberjack-config"`
	ZapConfig        ZapConfig          `yaml:"zap-config" json:"zap-config,omitempty" property:"zap-config"`
}

func (*LoggerConfig) Init

func (lc *LoggerConfig) Init() error

func (LoggerConfig) Prefix

func (LoggerConfig) Prefix() string

Prefix dubbo.logger

type LoggerConfigBuilder

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

func NewLoggerConfigBuilder

func NewLoggerConfigBuilder() *LoggerConfigBuilder

nolint

func (*LoggerConfigBuilder) Build

func (lcb *LoggerConfigBuilder) Build() *LoggerConfig

nolint

func (*LoggerConfigBuilder) SetLumberjackConfig

func (lcb *LoggerConfigBuilder) SetLumberjackConfig(lumberjackConfig *lumberjack.Logger) *LoggerConfigBuilder

nolint

func (*LoggerConfigBuilder) SetZapConfig

func (lcb *LoggerConfigBuilder) SetZapConfig(zapConfig ZapConfig) *LoggerConfigBuilder

nolint

type MeshRouteMetadata

type MeshRouteMetadata struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	YamlAPIVersion string         `yaml:"apiVersion" `
	YamlKind       string         `yaml:"kind" `
	MetaData       MetaDataStruct `yaml:"metadata"`
	Spec           interface{}
}

type MetaDataStruct

type MetaDataStruct struct {
	Name string `yaml:"name" json:"name"`
}

nolint

type MetadataReportConfig

type MetadataReportConfig struct {
	Protocol  string `required:"true"  yaml:"protocol"  json:"protocol,omitempty"`
	Address   string `required:"true" yaml:"address" json:"address"`
	Username  string `yaml:"username" json:"username,omitempty"`
	Password  string `yaml:"password" json:"password,omitempty"`
	Timeout   string `yaml:"timeout" json:"timeout,omitempty"`
	Group     string `yaml:"group" json:"group,omitempty"`
	Namespace string `yaml:"namespace" json:"namespace,omitempty"`
	// contains filtered or unexported fields
}

MetadataReportConfig is app level configuration

func GetMetadataReportConfg

func GetMetadataReportConfg() *MetadataReportConfig

func (*MetadataReportConfig) Init

func (mc *MetadataReportConfig) Init(rc *RootConfig) error

func (*MetadataReportConfig) IsValid

func (mc *MetadataReportConfig) IsValid() bool

func (MetadataReportConfig) Prefix

func (MetadataReportConfig) Prefix() string

Prefix dubbo.consumer

func (*MetadataReportConfig) StartMetadataReport

func (mc *MetadataReportConfig) StartMetadataReport() error

StartMetadataReport: The entry of metadata report start

func (*MetadataReportConfig) ToUrl

func (mc *MetadataReportConfig) ToUrl() (*common.URL, error)

type MetadataReportConfigBuilder

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

func NewMetadataReportConfigBuilder

func NewMetadataReportConfigBuilder() *MetadataReportConfigBuilder

nolint

func (*MetadataReportConfigBuilder) Build

nolint

func (*MetadataReportConfigBuilder) SetAddress

nolint

func (*MetadataReportConfigBuilder) SetGroup

nolint

func (*MetadataReportConfigBuilder) SetPassword

func (mrcb *MetadataReportConfigBuilder) SetPassword(password string) *MetadataReportConfigBuilder

nolint

func (*MetadataReportConfigBuilder) SetProtocol

func (mrcb *MetadataReportConfigBuilder) SetProtocol(protocol string) *MetadataReportConfigBuilder

nolint

func (*MetadataReportConfigBuilder) SetTimeout

nolint

func (*MetadataReportConfigBuilder) SetUsername

func (mrcb *MetadataReportConfigBuilder) SetUsername(username string) *MetadataReportConfigBuilder

nolint

type MethodConfig

type MethodConfig struct {
	InterfaceId                 string
	InterfaceName               string
	Name                        string `yaml:"name"  json:"name,omitempty" property:"name"`
	Retries                     string `yaml:"retries"  json:"retries,omitempty" property:"retries"`
	LoadBalance                 string `yaml:"loadbalance"  json:"loadbalance,omitempty" property:"loadbalance"`
	Weight                      int64  `yaml:"weight"  json:"weight,omitempty" property:"weight"`
	TpsLimitInterval            string `yaml:"tps.limit.interval" json:"tps.limit.interval,omitempty" property:"tps.limit.interval"`
	TpsLimitRate                string `yaml:"tps.limit.rate" json:"tps.limit.rate,omitempty" property:"tps.limit.rate"`
	TpsLimitStrategy            string `yaml:"tps.limit.strategy" json:"tps.limit.strategy,omitempty" property:"tps.limit.strategy"`
	ExecuteLimit                string `yaml:"execute.limit" json:"execute.limit,omitempty" property:"execute.limit"`
	ExecuteLimitRejectedHandler string `` /* 127-byte string literal not displayed */
	Sticky                      bool   `yaml:"sticky"   json:"sticky,omitempty" property:"sticky"`
	RequestTimeout              string `yaml:"timeout"  json:"timeout,omitempty" property:"timeout"`
}

MethodConfig defines method config

func (*MethodConfig) Init

func (mc *MethodConfig) Init() error

func (*MethodConfig) Prefix

func (mc *MethodConfig) Prefix() string

nolint

type MetricConfig

type MetricConfig struct {
	Mode               string `default:"pull" yaml:"mode" json:"mode,omitempty" property:"mode"` // push or pull,
	Namespace          string `default:"dubbo" yaml:"namespace" json:"namespace,omitempty" property:"namespace"`
	Enable             string `default:"true" yaml:"enable" json:"enable,omitempty" property:"enable"`
	Port               string `default:"9090" yaml:"port" json:"port,omitempty" property:"port"`
	Path               string `default:"/metrics" yaml:"path" json:"path,omitempty" property:"path"`
	PushGatewayAddress string `default:"" yaml:"push-gateway-address" json:"push-gateway-address,omitempty" property:"push-gateway-address"`
}

MetricConfig This is the config struct for all metrics implementation

func GetMetricConfig

func GetMetricConfig() *MetricConfig

GetMetricConfig find the MetricConfig if it is nil, create a new one we use double-check to reduce race condition In general, it will be locked 0 or 1 time. So you don't need to worry about the race condition

func (*MetricConfig) Init

func (mc *MetricConfig) Init() error

nolint

func (*MetricConfig) ToReporterConfig

func (m *MetricConfig) ToReporterConfig() *metrics.ReporterConfig

type MetricConfigBuilder

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

func NewMetricConfigBuilder

func NewMetricConfigBuilder() *MetricConfigBuilder

nolint

func (*MetricConfigBuilder) Build

func (mcb *MetricConfigBuilder) Build() *MetricConfig

nolint

type MockService

type MockService struct{}

MockService mocks the rpc service for test

func (*MockService) GetUser

func (*MockService) GetUser(ctx context.Context, itf []interface{}, str *struct{}) error

GetUser mocks the GetUser method

func (*MockService) GetUser1

func (*MockService) GetUser1(ctx context.Context, itf []interface{}, str *struct{}) error

GetUser1 mocks the GetUser1 method

func (*MockService) Reference

func (*MockService) Reference() string

Reference mocks the Reference method

type ProtocolConfig

type ProtocolConfig struct {
	Name   string      `default:"dubbo" validate:"required" yaml:"name" json:"name,omitempty" property:"name"`
	Ip     string      `yaml:"ip"  json:"ip,omitempty" property:"ip"`
	Port   string      `default:"20000" yaml:"port" json:"port,omitempty" property:"port"`
	Params interface{} `yaml:"params" json:"params,omitempty" property:"params"`
}

ProtocolConfig is protocol configuration

func (*ProtocolConfig) Init

func (p *ProtocolConfig) Init() error

func (ProtocolConfig) Prefix

func (ProtocolConfig) Prefix() string

Prefix dubbo.config-center

type ProtocolConfigBuilder

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

func NewProtocolConfigBuilder

func NewProtocolConfigBuilder() *ProtocolConfigBuilder

func (*ProtocolConfigBuilder) Build

func (pcb *ProtocolConfigBuilder) Build() *ProtocolConfig

func (*ProtocolConfigBuilder) SetIp

func (*ProtocolConfigBuilder) SetName

func (*ProtocolConfigBuilder) SetParams

func (pcb *ProtocolConfigBuilder) SetParams(params interface{}) *ProtocolConfigBuilder

func (*ProtocolConfigBuilder) SetPort

type ProviderConfig

type ProviderConfig struct {
	Filter string `yaml:"filter" json:"filter,omitempty" property:"filter"`
	// Deprecated Register whether registration is required
	Register bool `yaml:"register" json:"register" property:"register"`
	// RegistryIDs is registry ids list
	RegistryIDs []string `yaml:"registry-ids" json:"registry-ids" property:"registry-ids"`
	// Services services
	Services map[string]*ServiceConfig `yaml:"services" json:"services,omitempty" property:"services"`

	ProxyFactory string `default:"default" yaml:"proxy" json:"proxy,omitempty" property:"proxy"`

	FilterConf interface{}       `yaml:"filter_conf" json:"filter_conf,omitempty" property:"filter_conf"`
	ConfigType map[string]string `yaml:"config_type" json:"config_type,omitempty" property:"config_type"`
	// contains filtered or unexported fields
}

ProviderConfig is the default configuration of service provider

func GetProviderConfig

func GetProviderConfig() *ProviderConfig

func (*ProviderConfig) Init

func (c *ProviderConfig) Init(rc *RootConfig) error

func (*ProviderConfig) Load

func (c *ProviderConfig) Load()

func (ProviderConfig) Prefix

func (ProviderConfig) Prefix() string

type ProviderConfigBuilder

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

func NewProviderConfigBuilder

func NewProviderConfigBuilder() *ProviderConfigBuilder

func (*ProviderConfigBuilder) AddConfigType

func (pcb *ProviderConfigBuilder) AddConfigType(key, value string) *ProviderConfigBuilder

nolint

func (*ProviderConfigBuilder) AddService

func (pcb *ProviderConfigBuilder) AddService(serviceID string, serviceConfig *ServiceConfig) *ProviderConfigBuilder

nolint

func (*ProviderConfigBuilder) Build

func (pcb *ProviderConfigBuilder) Build() *ProviderConfig

nolint

func (*ProviderConfigBuilder) SetConfigType

func (pcb *ProviderConfigBuilder) SetConfigType(configType map[string]string) *ProviderConfigBuilder

nolint

func (*ProviderConfigBuilder) SetFilter

func (pcb *ProviderConfigBuilder) SetFilter(filter string) *ProviderConfigBuilder

func (*ProviderConfigBuilder) SetFilterConf

func (pcb *ProviderConfigBuilder) SetFilterConf(filterConf interface{}) *ProviderConfigBuilder

nolint

func (*ProviderConfigBuilder) SetProxyFactory

func (pcb *ProviderConfigBuilder) SetProxyFactory(proxyFactory string) *ProviderConfigBuilder

nolint

func (*ProviderConfigBuilder) SetRegister

func (pcb *ProviderConfigBuilder) SetRegister(register bool) *ProviderConfigBuilder

nolint

func (*ProviderConfigBuilder) SetRegistryIDs

func (pcb *ProviderConfigBuilder) SetRegistryIDs(RegistryIDs ...string) *ProviderConfigBuilder

nolint

func (*ProviderConfigBuilder) SetRootConfig

func (pcb *ProviderConfigBuilder) SetRootConfig(rootConfig *RootConfig) *ProviderConfigBuilder

nolint

func (*ProviderConfigBuilder) SetServices

func (pcb *ProviderConfigBuilder) SetServices(services map[string]*ServiceConfig) *ProviderConfigBuilder

nolint

type ReferenceConfig

type ReferenceConfig struct {
	InterfaceName string            `required:"true"  yaml:"interface"  json:"interface,omitempty" property:"interface"`
	Check         *bool             `yaml:"check"  json:"check,omitempty" property:"check"`
	URL           string            `yaml:"url"  json:"url,omitempty" property:"url"`
	Filter        string            `yaml:"filter" json:"filter,omitempty" property:"filter"`
	Protocol      string            `default:"tri" yaml:"protocol"  json:"protocol,omitempty" property:"protocol"`
	RegistryIDs   []string          `yaml:"registry-ids"  json:"registry-ids,omitempty"  property:"registry-ids"`
	Cluster       string            `yaml:"cluster"  json:"cluster,omitempty" property:"cluster"`
	Loadbalance   string            `yaml:"loadbalance"  json:"loadbalance,omitempty" property:"loadbalance"`
	Retries       string            `yaml:"retries"  json:"retries,omitempty" property:"retries"`
	Group         string            `yaml:"group"  json:"group,omitempty" property:"group"`
	Version       string            `yaml:"version"  json:"version,omitempty" property:"version"`
	Serialization string            `yaml:"serialization" json:"serialization" property:"serialization"`
	ProvidedBy    string            `yaml:"provided_by"  json:"provided_by,omitempty" property:"provided_by"`
	Methods       []*MethodConfig   `yaml:"methods"  json:"methods,omitempty" property:"methods"`
	Async         bool              `yaml:"async"  json:"async,omitempty" property:"async"`
	Params        map[string]string `yaml:"params"  json:"params,omitempty" property:"params"`

	Generic        string `yaml:"generic"  json:"generic,omitempty" property:"generic"`
	Sticky         bool   `yaml:"sticky"   json:"sticky,omitempty" property:"sticky"`
	RequestTimeout string `yaml:"timeout"  json:"timeout,omitempty" property:"timeout"`
	ForceTag       bool   `yaml:"force.tag"  json:"force.tag,omitempty" property:"force.tag"`
	// contains filtered or unexported fields
}

ReferenceConfig is the configuration of service consumer

func (*ReferenceConfig) GenericLoad

func (rc *ReferenceConfig) GenericLoad(id string)

GenericLoad ...

func (*ReferenceConfig) GetInvoker

func (rc *ReferenceConfig) GetInvoker() protocol.Invoker

GetInvoker get invoker from ReferenceConfig

func (*ReferenceConfig) GetProxy

func (rc *ReferenceConfig) GetProxy() *proxy.Proxy

GetProxy gets proxy

func (*ReferenceConfig) GetRPCService

func (rc *ReferenceConfig) GetRPCService() common.RPCService

GetRPCService gets RPCService from proxy

func (*ReferenceConfig) Implement

func (rc *ReferenceConfig) Implement(v common.RPCService)

Implement @v is service provider implemented RPCService

func (*ReferenceConfig) Init

func (rc *ReferenceConfig) Init(root *RootConfig) error

func (*ReferenceConfig) Prefix

func (rc *ReferenceConfig) Prefix() string

nolint

func (*ReferenceConfig) Refer

func (rc *ReferenceConfig) Refer(srv interface{})

Refer ...

type ReferenceConfigBuilder

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

func NewReferenceConfigBuilder

func NewReferenceConfigBuilder() *ReferenceConfigBuilder

func (*ReferenceConfigBuilder) Build

func (*ReferenceConfigBuilder) SetCluster

func (pcb *ReferenceConfigBuilder) SetCluster(cluster string) *ReferenceConfigBuilder

func (*ReferenceConfigBuilder) SetGeneric

func (pcb *ReferenceConfigBuilder) SetGeneric(generic bool) *ReferenceConfigBuilder

func (*ReferenceConfigBuilder) SetInterface

func (pcb *ReferenceConfigBuilder) SetInterface(interfaceName string) *ReferenceConfigBuilder

func (*ReferenceConfigBuilder) SetProtocol

func (pcb *ReferenceConfigBuilder) SetProtocol(protocol string) *ReferenceConfigBuilder

func (*ReferenceConfigBuilder) SetRegistryIDs

func (pcb *ReferenceConfigBuilder) SetRegistryIDs(registryIDs ...string) *ReferenceConfigBuilder

func (*ReferenceConfigBuilder) SetSerialization

func (pcb *ReferenceConfigBuilder) SetSerialization(serialization string) *ReferenceConfigBuilder

type RegistryConfig

type RegistryConfig struct {
	Protocol  string `validate:"required" yaml:"protocol"  json:"protocol,omitempty" property:"protocol"`
	Timeout   string `default:"5s" validate:"required" yaml:"timeout" json:"timeout,omitempty" property:"timeout"` // unit: second
	Group     string `yaml:"group" json:"group,omitempty" property:"group"`
	Namespace string `yaml:"namespace" json:"namespace,omitempty" property:"namespace"`
	TTL       string `default:"10s" yaml:"ttl" json:"ttl,omitempty" property:"ttl"` // unit: minute
	// for registry
	Address    string `validate:"required" yaml:"address" json:"address,omitempty" property:"address"`
	Username   string `yaml:"username" json:"username,omitempty" property:"username"`
	Password   string `yaml:"password" json:"password,omitempty"  property:"password"`
	Simplified bool   `yaml:"simplified" json:"simplified,omitempty"  property:"simplified"`
	// Always use this registry first if set to true, useful when subscribe to multiple registriesConfig
	Preferred bool `yaml:"preferred" json:"preferred,omitempty" property:"preferred"`
	// The region where the registry belongs, usually used to isolate traffics
	Zone string `yaml:"zone" json:"zone,omitempty" property:"zone"`
	// Affects traffic distribution among registriesConfig,
	// useful when subscribe to multiple registriesConfig Take effect only when no preferred registry is specified.
	Weight       int64             `yaml:"weight" json:"weight,omitempty" property:"weight"`
	Params       map[string]string `yaml:"params" json:"params,omitempty" property:"params"`
	RegistryType string            `yaml:"registry-type"`
}

RegistryConfig is the configuration of the registry center

func NewRegistryConfig

func NewRegistryConfig(opts ...RegistryConfigOpt) *RegistryConfig

NewRegistryConfig creates New RegistryConfig with @opts

func NewRegistryConfigWithProtocolDefaultPort

func NewRegistryConfigWithProtocolDefaultPort(protocol string) *RegistryConfig

NewRegistryConfigWithProtocolDefaultPort New default registry config the input @protocol can only be: "zookeeper" with default addr "127.0.0.1:2181" "nacos" with default addr "127.0.0.1:8848"

func (*RegistryConfig) GetInstance

func (c *RegistryConfig) GetInstance(roleType common.RoleType) (registry.Registry, error)

func (*RegistryConfig) Init

func (c *RegistryConfig) Init() error

func (RegistryConfig) Prefix

func (RegistryConfig) Prefix() string

Prefix dubbo.registries

type RegistryConfigBuilder

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

func NewRegistryConfigBuilder

func NewRegistryConfigBuilder() *RegistryConfigBuilder

func (*RegistryConfigBuilder) Build

func (rcb *RegistryConfigBuilder) Build() *RegistryConfig

func (*RegistryConfigBuilder) SetAddress

func (rcb *RegistryConfigBuilder) SetAddress(address string) *RegistryConfigBuilder

func (*RegistryConfigBuilder) SetGroup

func (rcb *RegistryConfigBuilder) SetGroup(group string) *RegistryConfigBuilder

func (*RegistryConfigBuilder) SetNamespace

func (rcb *RegistryConfigBuilder) SetNamespace(namespace string) *RegistryConfigBuilder

func (*RegistryConfigBuilder) SetParams

func (rcb *RegistryConfigBuilder) SetParams(params map[string]string) *RegistryConfigBuilder

func (*RegistryConfigBuilder) SetPassword

func (rcb *RegistryConfigBuilder) SetPassword(password string) *RegistryConfigBuilder

func (*RegistryConfigBuilder) SetPreferred

func (rcb *RegistryConfigBuilder) SetPreferred(preferred bool) *RegistryConfigBuilder

func (*RegistryConfigBuilder) SetProtocol

func (rcb *RegistryConfigBuilder) SetProtocol(protocol string) *RegistryConfigBuilder

func (*RegistryConfigBuilder) SetRegistryType

func (rcb *RegistryConfigBuilder) SetRegistryType(registryType string) *RegistryConfigBuilder

func (*RegistryConfigBuilder) SetSimplified

func (rcb *RegistryConfigBuilder) SetSimplified(simplified bool) *RegistryConfigBuilder

func (*RegistryConfigBuilder) SetTTL

func (*RegistryConfigBuilder) SetTimeout

func (rcb *RegistryConfigBuilder) SetTimeout(timeout string) *RegistryConfigBuilder

func (*RegistryConfigBuilder) SetUsername

func (rcb *RegistryConfigBuilder) SetUsername(username string) *RegistryConfigBuilder

func (*RegistryConfigBuilder) SetWeight

func (rcb *RegistryConfigBuilder) SetWeight(weight int64) *RegistryConfigBuilder

func (*RegistryConfigBuilder) SetZone

type RegistryConfigOpt

type RegistryConfigOpt func(config *RegistryConfig) *RegistryConfig

func WithRegistryAddress

func WithRegistryAddress(addr string) RegistryConfigOpt

WithRegistryAddress returns RegistryConfigOpt with given @addr registry address

func WithRegistryGroup

func WithRegistryGroup(group string) RegistryConfigOpt

WithRegistryGroup returns RegistryConfigOpt with given @group registry group

func WithRegistryParams

func WithRegistryParams(params map[string]string) RegistryConfigOpt

WithRegistryParams returns RegistryConfigOpt with given registry @params

func WithRegistryPassword

func WithRegistryPassword(psw string) RegistryConfigOpt

WithRegistryPassword returns RegistryConfigOpt with given @psw registry password

func WithRegistryPreferred

func WithRegistryPreferred(preferred bool) RegistryConfigOpt

WithRegistryPreferred returns RegistryConfig with given @preferred registry preferred flag

func WithRegistryProtocol

func WithRegistryProtocol(regProtocol string) RegistryConfigOpt

WithRegistryProtocol returns RegistryConfigOpt with given @regProtocol name

func WithRegistrySimplified

func WithRegistrySimplified(simplified bool) RegistryConfigOpt

WithRegistrySimplified returns RegistryConfigOpt with given @simplified registry simplified flag

func WithRegistryTTL

func WithRegistryTTL(ttl string) RegistryConfigOpt

WithRegistryTTL returns RegistryConfigOpt with given @ttl registry ttl

func WithRegistryTimeOut

func WithRegistryTimeOut(timeout string) RegistryConfigOpt

WithRegistryTimeOut returns RegistryConfigOpt with given @timeout registry config

func WithRegistryUserName

func WithRegistryUserName(userName string) RegistryConfigOpt

WithRegistryUserName returns RegistryConfigOpt with given @userName registry userName

func WithRegistryWeight

func WithRegistryWeight(weight int64) RegistryConfigOpt

WithRegistryWeight returns RegistryConfigOpt with given @weight registry weight flag

type RemoteConfig

type RemoteConfig struct {
	Protocol string            `yaml:"protocol"  json:"protocol,omitempty" property:"protocol"`
	Address  string            `yaml:"address" json:"address,omitempty" property:"address"`
	Timeout  string            `default:"5s" yaml:"timeout" json:"timeout,omitempty" property:"timeout"`
	Username string            `yaml:"username" json:"username,omitempty" property:"username"`
	Password string            `yaml:"password" json:"password,omitempty"  property:"password"`
	Params   map[string]string `yaml:"params" json:"params,omitempty"`
}

RemoteConfig usually we need some middleware, including nacos, zookeeper this represents an instance of this middleware so that other module, like config center, registry could reuse the config but now, only metadata report, metadata service, service discovery use this structure

func (*RemoteConfig) GetParam

func (rc *RemoteConfig) GetParam(key string, def string) string

GetParam will return the value of the key. If not found, def will be return; def => default value

func (*RemoteConfig) GetTimeout

func (rc *RemoteConfig) GetTimeout() time.Duration

GetTimeout return timeout duration. if the configure is invalid, or missing, the default value 5s will be returned

func (*RemoteConfig) Init

func (rc *RemoteConfig) Init() error

nolint

func (*RemoteConfig) Prefix

func (rc *RemoteConfig) Prefix() string

Prefix dubbo.remote.

func (*RemoteConfig) ToURL

func (rc *RemoteConfig) ToURL() (*common.URL, error)

ToURL config to url

type RemoteConfigBuilder

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

func NewRemoteConfigBuilder

func NewRemoteConfigBuilder() *RemoteConfigBuilder

func (*RemoteConfigBuilder) AddParam

func (rcb *RemoteConfigBuilder) AddParam(key, value string) *RemoteConfigBuilder

func (*RemoteConfigBuilder) Build

func (rcb *RemoteConfigBuilder) Build() *RemoteConfig

func (*RemoteConfigBuilder) SetAddress

func (rcb *RemoteConfigBuilder) SetAddress(address string) *RemoteConfigBuilder

func (*RemoteConfigBuilder) SetParams

func (rcb *RemoteConfigBuilder) SetParams(params map[string]string) *RemoteConfigBuilder

func (*RemoteConfigBuilder) SetPassword

func (rcb *RemoteConfigBuilder) SetPassword(password string) *RemoteConfigBuilder

func (*RemoteConfigBuilder) SetProtocol

func (rcb *RemoteConfigBuilder) SetProtocol(protocol string) *RemoteConfigBuilder

func (*RemoteConfigBuilder) SetTimeout

func (rcb *RemoteConfigBuilder) SetTimeout(timeout string) *RemoteConfigBuilder

func (*RemoteConfigBuilder) SetUsername

func (rcb *RemoteConfigBuilder) SetUsername(username string) *RemoteConfigBuilder

type RootConfig

type RootConfig struct {
	// Application applicationConfig config
	Application *ApplicationConfig `validate:"required" yaml:"application" json:"application,omitempty" property:"application"`

	Protocols map[string]*ProtocolConfig `validate:"required" yaml:"protocols" json:"protocols" property:"protocols"`

	// Registries registry config
	Registries map[string]*RegistryConfig `yaml:"registries" json:"registries" property:"registries"`

	// TODO ConfigCenter and CenterConfig?
	ConfigCenter *CenterConfig `yaml:"config-center" json:"config-center,omitempty"`

	MetadataReport *MetadataReportConfig `yaml:"metadata-report" json:"metadata-report,omitempty" property:"metadata-report"`

	// provider config
	Provider *ProviderConfig `yaml:"provider" json:"provider" property:"provider"`

	// consumer config
	Consumer *ConsumerConfig `yaml:"consumer" json:"consumer" property:"consumer"`

	Metric *MetricConfig `yaml:"metrics" json:"metrics,omitempty" property:"metrics"`

	// Logger log
	Logger *LoggerConfig `yaml:"logger" json:"logger,omitempty" property:"logger"`

	// Shutdown config
	Shutdown *ShutdownConfig `yaml:"shutdown" json:"shutdown,omitempty" property:"shutdown"`

	Router []*RouterConfig `yaml:"router" json:"router,omitempty" property:"router"`

	EventDispatcherType string `default:"direct" yaml:"event-dispatcher-type" json:"event-dispatcher-type,omitempty"`

	// cache file used to store the current used configurations.
	CacheFile string `yaml:"cache_file" json:"cache_file,omitempty" property:"cache_file"`
}

RootConfig is the root config

func GetRootConfig

func GetRootConfig() *RootConfig

func (*RootConfig) Init

func (rc *RootConfig) Init() error

Init is to start dubbo-go framework, load local configuration, or read configuration from config-center if necessary. It's deprecated for user to call rootConfig.Init() manually, try config.Load(config.WithRootConfig(rootConfig)) instead.

func (RootConfig) Prefix

func (RootConfig) Prefix() string

Prefix dubbo

func (*RootConfig) Start

func (rc *RootConfig) Start()

type RootConfigBuilder

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

func NewRootConfigBuilder

func NewRootConfigBuilder() *RootConfigBuilder

func (*RootConfigBuilder) AddProtocol

func (rb *RootConfigBuilder) AddProtocol(protocolID string, protocolConfig *ProtocolConfig) *RootConfigBuilder

func (*RootConfigBuilder) AddRegistry

func (rb *RootConfigBuilder) AddRegistry(registryID string, registryConfig *RegistryConfig) *RootConfigBuilder

func (*RootConfigBuilder) Build

func (rb *RootConfigBuilder) Build() *RootConfig

func (*RootConfigBuilder) SetApplication

func (rb *RootConfigBuilder) SetApplication(application *ApplicationConfig) *RootConfigBuilder

func (*RootConfigBuilder) SetCacheFile

func (rb *RootConfigBuilder) SetCacheFile(cacheFile string) *RootConfigBuilder

func (*RootConfigBuilder) SetConfigCenter

func (rb *RootConfigBuilder) SetConfigCenter(configCenterConfig *CenterConfig) *RootConfigBuilder

func (*RootConfigBuilder) SetConsumer

func (rb *RootConfigBuilder) SetConsumer(consumer *ConsumerConfig) *RootConfigBuilder

func (*RootConfigBuilder) SetEventDispatcherType

func (rb *RootConfigBuilder) SetEventDispatcherType(eventDispatcherType string) *RootConfigBuilder

func (*RootConfigBuilder) SetLogger

func (rb *RootConfigBuilder) SetLogger(logger *LoggerConfig) *RootConfigBuilder

func (*RootConfigBuilder) SetMetadataReport

func (rb *RootConfigBuilder) SetMetadataReport(metadataReport *MetadataReportConfig) *RootConfigBuilder

func (*RootConfigBuilder) SetMetric

func (rb *RootConfigBuilder) SetMetric(metric *MetricConfig) *RootConfigBuilder

func (*RootConfigBuilder) SetProtocols

func (rb *RootConfigBuilder) SetProtocols(protocols map[string]*ProtocolConfig) *RootConfigBuilder

func (*RootConfigBuilder) SetProvider

func (rb *RootConfigBuilder) SetProvider(provider *ProviderConfig) *RootConfigBuilder

func (*RootConfigBuilder) SetRegistries

func (rb *RootConfigBuilder) SetRegistries(registries map[string]*RegistryConfig) *RootConfigBuilder

func (*RootConfigBuilder) SetRouter

func (rb *RootConfigBuilder) SetRouter(router []*RouterConfig) *RootConfigBuilder

func (*RootConfigBuilder) SetShutdown

func (rb *RootConfigBuilder) SetShutdown(shutdown *ShutdownConfig) *RootConfigBuilder

type RouterConfig

type RouterConfig struct {
	// Scope must be chosen from `service` and `application`.
	Scope string `validate:"required" yaml:"scope" json:"scope,omitempty" property:"scope"`
	// Key specifies which service or application the rule body acts on.
	Key        string   `validate:"required" yaml:"key" json:"key,omitempty" property:"key"`
	Force      bool     `default:"false" yaml:"force" json:"force,omitempty" property:"force"`
	Runtime    bool     `default:"false" yaml:"runtime" json:"runtime,omitempty" property:"runtime"`
	Enable     bool     `default:"true" yaml:"enable" json:"enable,omitempty" property:"enable"`
	Valid      bool     `default:"true" yaml:"valid" json:"valid,omitempty" property:"valid"`
	Priority   int      `default:"0" yaml:"priority" json:"priority,omitempty" property:"priority"`
	Conditions []string `yaml:"conditions" json:"conditions,omitempty" property:"conditions"`
	Tags       []Tag    `yaml:"tags" json:"tags,omitempty" property:"tags"`
}

RouterConfig is the configuration of the router.

func (*RouterConfig) Init

func (c *RouterConfig) Init() error

func (RouterConfig) Prefix

func (RouterConfig) Prefix() string

Prefix dubbo.router

type RouterConfigBuilder

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

func NewRouterConfigBuilder

func NewRouterConfigBuilder() *RouterConfigBuilder

nolint

func (*RouterConfigBuilder) AddCondition

func (rcb *RouterConfigBuilder) AddCondition(condition string) *RouterConfigBuilder

nolint

func (*RouterConfigBuilder) AddTag

func (rcb *RouterConfigBuilder) AddTag(tag Tag) *RouterConfigBuilder

nolint

func (*RouterConfigBuilder) Build

func (rcb *RouterConfigBuilder) Build() *RouterConfig

nolint

func (*RouterConfigBuilder) SetConditions

func (rcb *RouterConfigBuilder) SetConditions(conditions []string) *RouterConfigBuilder

nolint

func (*RouterConfigBuilder) SetEnable

func (rcb *RouterConfigBuilder) SetEnable(enable bool) *RouterConfigBuilder

nolint

func (*RouterConfigBuilder) SetForce

func (rcb *RouterConfigBuilder) SetForce(force bool) *RouterConfigBuilder

nolint

func (*RouterConfigBuilder) SetKey

nolint

func (*RouterConfigBuilder) SetPriority

func (rcb *RouterConfigBuilder) SetPriority(priority int) *RouterConfigBuilder

nolint

func (*RouterConfigBuilder) SetRuntime

func (rcb *RouterConfigBuilder) SetRuntime(runtime bool) *RouterConfigBuilder

nolint

func (*RouterConfigBuilder) SetScope

func (rcb *RouterConfigBuilder) SetScope(scope string) *RouterConfigBuilder

nolint

func (*RouterConfigBuilder) SetTags

func (rcb *RouterConfigBuilder) SetTags(tags []Tag) *RouterConfigBuilder

nolint

func (*RouterConfigBuilder) SetValid

func (rcb *RouterConfigBuilder) SetValid(valid bool) *RouterConfigBuilder

nolint

type RouterDest

type RouterDest struct {
	Host     string            `yaml:"host" json:"host"`
	Subset   string            `yaml:"subset" json:"subset"`
	Weight   int               `yaml:"weight" json:"weight"`
	Fallback *DubboDestination `yaml:"fallback" json:"fallback"`
}

nolint

type ServiceConfig

type ServiceConfig struct {
	Filter                      string            `yaml:"filter" json:"filter,omitempty" property:"filter"`
	ProtocolIDs                 []string          `yaml:"protocol-ids"  json:"protocol-ids,omitempty" property:"protocol-ids"` // multi protocolIDs support, split by ','
	Interface                   string            `validate:"required"  yaml:"interface"  json:"interface,omitempty" property:"interface"`
	RegistryIDs                 []string          `yaml:"registry-ids"  json:"registry-ids,omitempty"  property:"registry-ids"`
	Cluster                     string            `default:"failover" yaml:"cluster"  json:"cluster,omitempty" property:"cluster"`
	Loadbalance                 string            `default:"random" yaml:"loadbalance"  json:"loadbalance,omitempty"  property:"loadbalance"`
	Group                       string            `yaml:"group"  json:"group,omitempty" property:"group"`
	Version                     string            `yaml:"version"  json:"version,omitempty" property:"version" `
	Methods                     []*MethodConfig   `yaml:"methods"  json:"methods,omitempty" property:"methods"`
	Warmup                      string            `yaml:"warmup"  json:"warmup,omitempty"  property:"warmup"`
	Retries                     string            `yaml:"retries"  json:"retries,omitempty" property:"retries"`
	Serialization               string            `yaml:"serialization" json:"serialization" property:"serialization"`
	Params                      map[string]string `yaml:"params"  json:"params,omitempty" property:"params"`
	Token                       string            `yaml:"token" json:"token,omitempty" property:"token"`
	AccessLog                   string            `yaml:"accesslog" json:"accesslog,omitempty" property:"accesslog"`
	TpsLimiter                  string            `yaml:"tps.limiter" json:"tps.limiter,omitempty" property:"tps.limiter"`
	TpsLimitInterval            string            `yaml:"tps.limit.interval" json:"tps.limit.interval,omitempty" property:"tps.limit.interval"`
	TpsLimitRate                string            `yaml:"tps.limit.rate" json:"tps.limit.rate,omitempty" property:"tps.limit.rate"`
	TpsLimitStrategy            string            `yaml:"tps.limit.strategy" json:"tps.limit.strategy,omitempty" property:"tps.limit.strategy"`
	TpsLimitRejectedHandler     string            `yaml:"tps.limit.rejected.handler" json:"tps.limit.rejected.handler,omitempty" property:"tps.limit.rejected.handler"`
	ExecuteLimit                string            `yaml:"execute.limit" json:"execute.limit,omitempty" property:"execute.limit"`
	ExecuteLimitRejectedHandler string            `` /* 127-byte string literal not displayed */
	Auth                        string            `yaml:"auth" json:"auth,omitempty" property:"auth"`
	ParamSign                   string            `yaml:"param.sign" json:"param.sign,omitempty" property:"param.sign"`
	Tag                         string            `yaml:"tag" json:"tag,omitempty" property:"tag"`
	GrpcMaxMessageSize          int               `default:"4" yaml:"max_message_size" json:"max_message_size,omitempty"`

	RCProtocolsMap  map[string]*ProtocolConfig
	RCRegistriesMap map[string]*RegistryConfig
	ProxyFactoryKey string
	// contains filtered or unexported fields
}

ServiceConfig is the configuration of the service provider

func (*ServiceConfig) Export

func (svc *ServiceConfig) Export() error

Export exports the service

func (*ServiceConfig) GetExportedUrls

func (svc *ServiceConfig) GetExportedUrls() []*common.URL

GetExportedUrls will return the url in service config's exporter

func (*ServiceConfig) Implement

func (svc *ServiceConfig) Implement(s common.RPCService)

Implement only store the @s and return

func (*ServiceConfig) Init

func (svc *ServiceConfig) Init(rc *RootConfig) error

func (*ServiceConfig) InitExported

func (svc *ServiceConfig) InitExported()

InitExported will set exported as false atom bool

func (*ServiceConfig) IsExport

func (svc *ServiceConfig) IsExport() bool

IsExport will return whether the service config is exported or not

func (*ServiceConfig) Prefix

func (svc *ServiceConfig) Prefix() string

Prefix returns dubbo.service.${InterfaceName}.

func (*ServiceConfig) Unexport

func (svc *ServiceConfig) Unexport()

Unexport will call unexport of all exporters service config exported

type ServiceConfigBuilder

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

func NewServiceConfigBuilder

func NewServiceConfigBuilder() *ServiceConfigBuilder

func (*ServiceConfigBuilder) AddRCProtocol

func (pcb *ServiceConfigBuilder) AddRCProtocol(protocolName string, protocolConfig *ProtocolConfig) *ServiceConfigBuilder

func (*ServiceConfigBuilder) AddRCRegistry

func (pcb *ServiceConfigBuilder) AddRCRegistry(registryName string, registryConfig *RegistryConfig) *ServiceConfigBuilder

func (*ServiceConfigBuilder) Build

func (pcb *ServiceConfigBuilder) Build() *ServiceConfig

func (*ServiceConfigBuilder) SetCluster

func (pcb *ServiceConfigBuilder) SetCluster(cluster string) *ServiceConfigBuilder

func (*ServiceConfigBuilder) SetGroup

func (pcb *ServiceConfigBuilder) SetGroup(group string) *ServiceConfigBuilder

func (*ServiceConfigBuilder) SetInterface

func (pcb *ServiceConfigBuilder) SetInterface(interfaceName string) *ServiceConfigBuilder

func (*ServiceConfigBuilder) SetLoadBalancce

func (pcb *ServiceConfigBuilder) SetLoadBalancce(lb string) *ServiceConfigBuilder

func (*ServiceConfigBuilder) SetMetadataType

func (pcb *ServiceConfigBuilder) SetMetadataType(setMetadataType string) *ServiceConfigBuilder

func (*ServiceConfigBuilder) SetProtocolIDs

func (pcb *ServiceConfigBuilder) SetProtocolIDs(protocolIDs ...string) *ServiceConfigBuilder

func (*ServiceConfigBuilder) SetProxyFactoryKey

func (pcb *ServiceConfigBuilder) SetProxyFactoryKey(proxyFactoryKey string) *ServiceConfigBuilder

func (*ServiceConfigBuilder) SetRPCService

func (pcb *ServiceConfigBuilder) SetRPCService(service common.RPCService) *ServiceConfigBuilder

func (*ServiceConfigBuilder) SetRegistryIDs

func (pcb *ServiceConfigBuilder) SetRegistryIDs(registryIDs ...string) *ServiceConfigBuilder

func (*ServiceConfigBuilder) SetSerialization

func (pcb *ServiceConfigBuilder) SetSerialization(serialization string) *ServiceConfigBuilder

func (*ServiceConfigBuilder) SetServiceID

func (pcb *ServiceConfigBuilder) SetServiceID(id string) *ServiceConfigBuilder

func (*ServiceConfigBuilder) SetVersion

func (pcb *ServiceConfigBuilder) SetVersion(version string) *ServiceConfigBuilder

func (*ServiceConfigBuilder) SetWarmUpTie

func (pcb *ServiceConfigBuilder) SetWarmUpTie(warmUp string) *ServiceConfigBuilder

type ServiceDiscoveryConfig

type ServiceDiscoveryConfig struct {
	// Protocol indicate which implementation will be used.
	// for example, if the Protocol is nacos, it means that we will use nacosServiceDiscovery
	Protocol string `yaml:"protocol" json:"protocol,omitempty" property:"protocol"`
	// Group, usually you don't need to config this field.
	// you can use this to do some isolation
	Group string `yaml:"group" json:"group,omitempty"`
	// RemoteRef is the reference point to RemoteConfig which will be used to create remotes instances.
	RemoteRef string `yaml:"remote_ref" json:"remote_ref,omitempty" property:"remote_ref"`
}

ServiceDiscoveryConfig will be used to create

func (ServiceDiscoveryConfig) Init

func (ServiceDiscoveryConfig) Prefix

func (ServiceDiscoveryConfig) Prefix() string

type ServiceDiscoveryConfigBuilder

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

func NewServiceDiscoveryConfigBuilder

func NewServiceDiscoveryConfigBuilder() *ServiceDiscoveryConfigBuilder

func (*ServiceDiscoveryConfigBuilder) Build

func (*ServiceDiscoveryConfigBuilder) SetGroup

func (*ServiceDiscoveryConfigBuilder) SetProtocol

func (*ServiceDiscoveryConfigBuilder) SetRemoteRef

type Setter

type Setter interface {
	Set(name string, config interface{})
}

type ShutdownConfig

type ShutdownConfig struct {
	/*
	 * Total timeout. Even though we don't release all resources,
	 * the applicationConfig will shutdown if the costing time is over this configuration. The unit is ms.
	 * default value is 60 * 1000 ms = 1 minutes
	 * In general, it should be bigger than 3 * StepTimeout.
	 */
	Timeout string `default:"60s" yaml:"timeout" json:"timeout,omitempty" property:"timeout"`
	/*
	 * the timeout on each step. You should evaluate the response time of request
	 * and the time that client noticed that server shutdown.
	 * For example, if your client will received the notification within 10s when you start to close server,
	 * and the 99.9% requests will return response in 2s, so the StepTimeout will be bigger than(10+2) * 1000ms,
	 * maybe (10 + 2*3) * 1000ms is a good choice.
	 */
	StepTimeout string `default:"10s" yaml:"step_timeout" json:"step.timeout,omitempty" property:"step.timeout"`
	// when we try to shutdown the applicationConfig, we will reject the new requests. In most cases, you don't need to configure this.
	RejectRequestHandler string `yaml:"reject_handler" json:"reject_handler,omitempty" property:"reject_handler"`
	// true -> new request will be rejected.
	RejectRequest bool
	// true -> all requests had been processed. In provider side it means that all requests are returned response to clients
	// In consumer side, it means that all requests getting response from servers
	RequestsFinished bool
}

ShutdownConfig is used as configuration for graceful shutdown

func (*ShutdownConfig) GetStepTimeout

func (config *ShutdownConfig) GetStepTimeout() time.Duration

nolint

func (*ShutdownConfig) GetTimeout

func (config *ShutdownConfig) GetTimeout() time.Duration

nolint

func (*ShutdownConfig) Prefix

func (config *ShutdownConfig) Prefix() string

Prefix dubbo.shutdown

type ShutdownConfigBuilder

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

func NewShutDownConfigBuilder

func NewShutDownConfigBuilder() *ShutdownConfigBuilder

func (*ShutdownConfigBuilder) Build

func (scb *ShutdownConfigBuilder) Build() *ShutdownConfig

func (*ShutdownConfigBuilder) SetRejectRequest

func (scb *ShutdownConfigBuilder) SetRejectRequest(rejectRequest bool) *ShutdownConfigBuilder

func (*ShutdownConfigBuilder) SetRejectRequestHandler

func (scb *ShutdownConfigBuilder) SetRejectRequestHandler(rejectRequestHandler string) *ShutdownConfigBuilder

func (*ShutdownConfigBuilder) SetRequestsFinished

func (scb *ShutdownConfigBuilder) SetRequestsFinished(requestsFinished bool) *ShutdownConfigBuilder

func (*ShutdownConfigBuilder) SetStepTimeout

func (scb *ShutdownConfigBuilder) SetStepTimeout(stepTimeout string) *ShutdownConfigBuilder

func (*ShutdownConfigBuilder) SetTimeout

func (scb *ShutdownConfigBuilder) SetTimeout(timeout string) *ShutdownConfigBuilder

type StringMatch

type StringMatch struct {
	Exact   string `yaml:"exact" json:"exact"`
	Prefix  string `yaml:"prefix" json:"prefix"`
	Regex   string `yaml:"regex" json:"regex"`
	NoEmpty string `yaml:"noempty" json:"noempty"`
	Empty   string `yaml:"empty" json:"empty"`
}

nolint

type Tag

type Tag struct {
	Name      string   `yaml:"name" json:"name,omitempty" property:"name"`
	Addresses []string `yaml:"addresses" json:"addresses,omitempty" property:"addresses"`
}

type UniformRouterConfigSpec

type UniformRouterConfigSpec struct {
	Hosts []string      `yaml:"hosts" json:"hosts"`
	Dubbo []*DubboRoute `yaml:"dubbo" json:"dubbo"`
}

nolint

type VirtualServiceConfig

type VirtualServiceConfig struct {
	YamlAPIVersion    string `yaml:"apiVersion"`
	YamlKind          string `yaml:"kind"`
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	MetaData          MetaDataStruct          `yaml:"metadata"`
	Spec              UniformRouterConfigSpec `yaml:"spec" json:"spec"`
}

VirtualServiceConfig Config Definition

func (*VirtualServiceConfig) DeepCopyObject

func (urc *VirtualServiceConfig) DeepCopyObject() runtime.Object

nolint

type VirtualServiceConfigList

type VirtualServiceConfigList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []VirtualServiceConfig `json:"items"`
}

nolint

func (*VirtualServiceConfigList) DeepCopyObject

func (drc *VirtualServiceConfigList) DeepCopyObject() runtime.Object

nolint

type ZapConfig

type ZapConfig struct {
	Level             string                 `default:"info" json:"level,omitempty" yaml:"level" property:"level"`
	Development       bool                   `default:"false" json:"development,omitempty" yaml:"development" property:"development"`
	DisableCaller     bool                   `default:"false" json:"disable-caller,omitempty" yaml:"disable-caller" property:"disable-caller"`
	DisableStacktrace bool                   `default:"false" json:"disable-stacktrace,omitempty" yaml:"disable-stacktrace" property:"disable-stacktrace"`
	Encoding          string                 `default:"console" json:"encoding,omitempty" yaml:"encoding" property:"encoding"`
	EncoderConfig     EncoderConfig          `default:"" json:"encoder-config,omitempty" yaml:"encoder-config" property:"encoder-config"`
	OutputPaths       []string               `default:"[\"stderr\"]" json:"output-paths,omitempty" yaml:"output-paths" property:"output-paths"`
	ErrorOutputPaths  []string               `default:"[\"stderr\"]" json:"error-output-paths,omitempty" yaml:"error-output-paths" property:"error-output-paths"`
	InitialFields     map[string]interface{} `default:"" json:"initial-fields,omitempty" yaml:"initial-fields" property:"initial-fields"`
}

Directories

Path Synopsis
parsers

Jump to

Keyboard shortcuts

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