Documentation ¶
Index ¶
- Constants
- Variables
- func GetContainerNameEnvList() []string
- func RegisterPluginConfigType(typ common.Type, name string, cfg BaseConfig)
- func ServiceClusterToServiceKey(config ServerClusterConfig) model.ServiceKey
- type APIConfig
- type APIConfigImpl
- func (a *APIConfigImpl) GetBindIP() string
- func (a *APIConfigImpl) GetBindIntf() string
- func (a *APIConfigImpl) GetMaxRetryTimes() int
- func (a *APIConfigImpl) GetReportInterval() time.Duration
- func (a *APIConfigImpl) GetRetryInterval() time.Duration
- func (a *APIConfigImpl) GetTimeout() time.Duration
- func (a *APIConfigImpl) SetBindIP(bindIPValue string)
- func (a *APIConfigImpl) SetBindIntf(bindIntf string)
- func (a *APIConfigImpl) SetDefault()
- func (a *APIConfigImpl) SetMaxRetryTimes(maxRetryTimes int)
- func (a *APIConfigImpl) SetReportInterval(interval time.Duration)
- func (a *APIConfigImpl) SetRetryInterval(interval time.Duration)
- func (a *APIConfigImpl) SetTimeout(timeout time.Duration)
- func (a *APIConfigImpl) Verify() error
- type BaseConfig
- type CircuitBreakerConfig
- type CircuitBreakerConfigImpl
- func (c *CircuitBreakerConfigImpl) GetChain() []string
- func (c *CircuitBreakerConfigImpl) GetCheckPeriod() time.Duration
- func (c *CircuitBreakerConfigImpl) GetErrorCountConfig() ErrorCountConfig
- func (c *CircuitBreakerConfigImpl) GetErrorRateConfig() ErrorRateConfig
- func (c *CircuitBreakerConfigImpl) GetPluginConfig(pluginName string) BaseConfig
- func (c *CircuitBreakerConfigImpl) GetRecoverNumBuckets() int
- func (c *CircuitBreakerConfigImpl) GetRecoverWindow() time.Duration
- func (c *CircuitBreakerConfigImpl) GetRequestCountAfterHalfOpen() int
- func (c *CircuitBreakerConfigImpl) GetSleepWindow() time.Duration
- func (c *CircuitBreakerConfigImpl) GetSuccessCountAfterHalfOpen() int
- func (c *CircuitBreakerConfigImpl) Init()
- func (c *CircuitBreakerConfigImpl) IsEnable() bool
- func (c *CircuitBreakerConfigImpl) SetChain(chain []string)
- func (c *CircuitBreakerConfigImpl) SetCheckPeriod(period time.Duration)
- func (c *CircuitBreakerConfigImpl) SetDefault()
- func (c *CircuitBreakerConfigImpl) SetEnable(enable bool)
- func (c *CircuitBreakerConfigImpl) SetPluginConfig(pluginName string, value BaseConfig) error
- func (c *CircuitBreakerConfigImpl) SetRecoverNumBuckets(value int)
- func (c *CircuitBreakerConfigImpl) SetRecoverWindow(value time.Duration)
- func (c *CircuitBreakerConfigImpl) SetRequestCountAfterHalfOpen(count int)
- func (c *CircuitBreakerConfigImpl) SetSleepWindow(interval time.Duration)
- func (c *CircuitBreakerConfigImpl) SetSuccessCountAfterHalfOpen(count int)
- func (c *CircuitBreakerConfigImpl) Verify() error
- type ClusterService
- type ClusterType
- type ConfigConnectorConfig
- type ConfigConnectorConfigImpl
- func (c *ConfigConnectorConfigImpl) GetAddresses() []string
- func (c *ConfigConnectorConfigImpl) GetConnectTimeout() time.Duration
- func (c *ConfigConnectorConfigImpl) GetConnectionIdleTimeout() time.Duration
- func (c *ConfigConnectorConfigImpl) GetConnectorType() string
- func (c *ConfigConnectorConfigImpl) GetMessageTimeout() time.Duration
- func (c *ConfigConnectorConfigImpl) GetPluginConfig(pluginName string) BaseConfig
- func (c *ConfigConnectorConfigImpl) GetProtocol() string
- func (c *ConfigConnectorConfigImpl) GetReconnectInterval() time.Duration
- func (c *ConfigConnectorConfigImpl) GetRequestQueueSize() int32
- func (c *ConfigConnectorConfigImpl) GetServerSwitchInterval() time.Duration
- func (c *ConfigConnectorConfigImpl) Init()
- func (c *ConfigConnectorConfigImpl) SetAddresses(addresses []string)
- func (c *ConfigConnectorConfigImpl) SetConnectTimeout(timeout time.Duration)
- func (c *ConfigConnectorConfigImpl) SetConnectionIdleTimeout(timeout time.Duration)
- func (c *ConfigConnectorConfigImpl) SetConnectorType(connectorType string)
- func (c *ConfigConnectorConfigImpl) SetDefault()
- func (c *ConfigConnectorConfigImpl) SetMessageTimeout(timeout time.Duration)
- func (c *ConfigConnectorConfigImpl) SetPluginConfig(pluginName string, value BaseConfig) error
- func (c *ConfigConnectorConfigImpl) SetProtocol(protocol string)
- func (c *ConfigConnectorConfigImpl) SetReconnectInterval(interval time.Duration)
- func (c *ConfigConnectorConfigImpl) SetRequestQueueSize(queueSize int32)
- func (c *ConfigConnectorConfigImpl) SetServerSwitchInterval(interval time.Duration)
- func (c *ConfigConnectorConfigImpl) Verify() error
- type ConfigFileConfig
- type ConfigFileConfigImpl
- func (c *ConfigFileConfigImpl) GetConfigConnectorConfig() ConfigConnectorConfig
- func (c *ConfigFileConfigImpl) GetConfigFilterConfig() ConfigFilterConfig
- func (c *ConfigFileConfigImpl) GetPropertiesValueCacheSize() int32
- func (c *ConfigFileConfigImpl) GetPropertiesValueExpireTime() int64
- func (c *ConfigFileConfigImpl) Init()
- func (c *ConfigFileConfigImpl) IsEnable() bool
- func (c *ConfigFileConfigImpl) SetDefault()
- func (c *ConfigFileConfigImpl) SetEnable(enable bool)
- func (c *ConfigFileConfigImpl) SetPropertiesValueCacheSize(propertiesValueCacheSize int32)
- func (c *ConfigFileConfigImpl) SetPropertiesValueExpireTime(propertiesValueExpireTime int64)
- func (c *ConfigFileConfigImpl) Verify() error
- type ConfigFilterConfig
- type ConfigFilterConfigImpl
- func (c *ConfigFilterConfigImpl) GetChain() []string
- func (c *ConfigFilterConfigImpl) GetPluginConfig(pluginName string) BaseConfig
- func (c *ConfigFilterConfigImpl) Init()
- func (c *ConfigFilterConfigImpl) IsEnable() bool
- func (c *ConfigFilterConfigImpl) SetChain(chain []string)
- func (c *ConfigFilterConfigImpl) SetDefault()
- func (c *ConfigFilterConfigImpl) SetEnable(enable bool)
- func (c *ConfigFilterConfigImpl) SetPluginConfig(pluginName string, value BaseConfig) error
- func (c *ConfigFilterConfigImpl) Verify() error
- type Configuration
- type ConfigurationImpl
- func LoadConfiguration(buf []byte) (*ConfigurationImpl, error)
- func LoadConfigurationByDefaultFile() (*ConfigurationImpl, error)
- func LoadConfigurationByFile(path string) (*ConfigurationImpl, error)
- func NewDefaultConfiguration(addresses []string) *ConfigurationImpl
- func NewDefaultConfigurationWithDomain() *ConfigurationImpl
- func (c *ConfigurationImpl) GetConfigFile() ConfigFileConfig
- func (c *ConfigurationImpl) GetConsumer() ConsumerConfig
- func (c *ConfigurationImpl) GetGlobal() GlobalConfig
- func (c *ConfigurationImpl) GetProvider() ProviderConfig
- func (c *ConfigurationImpl) Init()
- func (c *ConfigurationImpl) SetDefault()
- func (c *ConfigurationImpl) Verify() error
- type ConsumerConfig
- type ConsumerConfigImpl
- func (c *ConsumerConfigImpl) GetCircuitBreaker() CircuitBreakerConfig
- func (c *ConsumerConfigImpl) GetHealthCheck() HealthCheckConfig
- func (c *ConsumerConfigImpl) GetLoadbalancer() LoadbalancerConfig
- func (c *ConsumerConfigImpl) GetLocalCache() LocalCacheConfig
- func (c *ConsumerConfigImpl) GetServiceRouter() ServiceRouterConfig
- func (c *ConsumerConfigImpl) GetServiceSpecific(namespace string, service string) ServiceSpecificConfig
- func (c *ConsumerConfigImpl) Init()
- func (c *ConsumerConfigImpl) SetDefault()
- func (c *ConsumerConfigImpl) Verify() error
- type ErrorCountConfig
- type ErrorRateConfig
- type GlobalConfig
- type GlobalConfigImpl
- func (g *GlobalConfigImpl) GetAPI() APIConfig
- func (g *GlobalConfigImpl) GetLocation() LocationConfig
- func (g *GlobalConfigImpl) GetServerConnector() ServerConnectorConfig
- func (g *GlobalConfigImpl) GetStatReporter() StatReporterConfig
- func (g *GlobalConfigImpl) GetSystem() SystemConfig
- func (g *GlobalConfigImpl) Init()
- func (g *GlobalConfigImpl) SetDefault()
- func (g *GlobalConfigImpl) Verify() error
- type HealthCheckConfig
- type HealthCheckConfigImpl
- func (h *HealthCheckConfigImpl) GetChain() []string
- func (h *HealthCheckConfigImpl) GetConcurrency() int
- func (h *HealthCheckConfigImpl) GetInterval() time.Duration
- func (h *HealthCheckConfigImpl) GetPluginConfig(pluginName string) BaseConfig
- func (h *HealthCheckConfigImpl) GetTimeout() time.Duration
- func (h *HealthCheckConfigImpl) GetWhen() When
- func (h *HealthCheckConfigImpl) Init()
- func (h *HealthCheckConfigImpl) SetChain(chain []string)
- func (h *HealthCheckConfigImpl) SetConcurrency(value int)
- func (h *HealthCheckConfigImpl) SetDefault()
- func (h *HealthCheckConfigImpl) SetInterval(duration time.Duration)
- func (h *HealthCheckConfigImpl) SetPluginConfig(pluginName string, value BaseConfig) error
- func (h *HealthCheckConfigImpl) SetTimeout(duration time.Duration)
- func (h *HealthCheckConfigImpl) SetWhen(when When)
- func (h *HealthCheckConfigImpl) Verify() error
- type LoadBalancerConfigImpl
- func (l *LoadBalancerConfigImpl) GetPluginConfig(pluginName string) BaseConfig
- func (l *LoadBalancerConfigImpl) GetType() string
- func (l *LoadBalancerConfigImpl) Init()
- func (l *LoadBalancerConfigImpl) SetDefault()
- func (l *LoadBalancerConfigImpl) SetPluginConfig(pluginName string, value BaseConfig) error
- func (l *LoadBalancerConfigImpl) SetType(typ string)
- func (l *LoadBalancerConfigImpl) Verify() error
- type LoadbalancerConfig
- type LocalCacheConfig
- type LocalCacheConfigImpl
- func (l *LocalCacheConfigImpl) GetPersistAvailableInterval() time.Duration
- func (l *LocalCacheConfigImpl) GetPersistDir() string
- func (l *LocalCacheConfigImpl) GetPersistMaxReadRetry() int
- func (l *LocalCacheConfigImpl) GetPersistMaxWriteRetry() int
- func (l *LocalCacheConfigImpl) GetPersistRetryInterval() time.Duration
- func (l *LocalCacheConfigImpl) GetPluginConfig(pluginName string) BaseConfig
- func (l *LocalCacheConfigImpl) GetPushEmptyProtection() bool
- func (l *LocalCacheConfigImpl) GetServiceExpireTime() time.Duration
- func (l *LocalCacheConfigImpl) GetServiceRefreshInterval() time.Duration
- func (l *LocalCacheConfigImpl) GetStartUseFileCache() bool
- func (l *LocalCacheConfigImpl) GetType() string
- func (l *LocalCacheConfigImpl) Init()
- func (l *LocalCacheConfigImpl) IsPersistEnable() bool
- func (l *LocalCacheConfigImpl) SetDefault()
- func (l *LocalCacheConfigImpl) SetPersistAvailableInterval(interval time.Duration)
- func (l *LocalCacheConfigImpl) SetPersistDir(dir string)
- func (l *LocalCacheConfigImpl) SetPersistEnable(enable bool)
- func (l *LocalCacheConfigImpl) SetPersistMaxReadRetry(maxReadRetry int)
- func (l *LocalCacheConfigImpl) SetPersistMaxWriteRetry(maxWriteRetry int)
- func (l *LocalCacheConfigImpl) SetPersistRetryInterval(interval time.Duration)
- func (l *LocalCacheConfigImpl) SetPluginConfig(pluginName string, value BaseConfig) error
- func (l *LocalCacheConfigImpl) SetPushEmptyProtection(pushEmptyProtection bool)
- func (l *LocalCacheConfigImpl) SetServiceExpireTime(expireTime time.Duration)
- func (l *LocalCacheConfigImpl) SetServiceRefreshInterval(interval time.Duration)
- func (l *LocalCacheConfigImpl) SetStartUseFileCache(useCacheFile bool)
- func (l *LocalCacheConfigImpl) SetType(typ string)
- func (l *LocalCacheConfigImpl) Verify() error
- type LocationConfig
- type LocationConfigImpl
- type LocationProviderConfigImpl
- type NearbyConfig
- type PluginConfig
- type PluginConfigs
- func (p PluginConfigs) GetPluginConfig(pluginName string) BaseConfig
- func (p PluginConfigs) Init(typ common.Type)
- func (p PluginConfigs) SetDefault(typ common.Type)
- func (p PluginConfigs) SetPluginConfig(plugType common.Type, plugName string, value BaseConfig) error
- func (p PluginConfigs) Verify() error
- type ProviderConfig
- type ProviderConfigImpl
- type RateLimitConfig
- type RateLimitConfigImpl
- func (r *RateLimitConfigImpl) GetLimiterNamespace() string
- func (r *RateLimitConfigImpl) GetLimiterService() string
- func (r *RateLimitConfigImpl) GetMaxWindowSize() int
- func (r *RateLimitConfigImpl) GetPluginConfig(pluginName string) BaseConfig
- func (r *RateLimitConfigImpl) GetPurgeInterval() time.Duration
- func (r *RateLimitConfigImpl) Init()
- func (r *RateLimitConfigImpl) IsEnable() bool
- func (r *RateLimitConfigImpl) SetDefault()
- func (r *RateLimitConfigImpl) SetEnable(value bool)
- func (r *RateLimitConfigImpl) SetLimiterNamespace(value string)
- func (r *RateLimitConfigImpl) SetLimiterService(value string)
- func (r *RateLimitConfigImpl) SetMaxWindowSize(maxSize int)
- func (r *RateLimitConfigImpl) SetPluginConfig(pluginName string, value BaseConfig) error
- func (r *RateLimitConfigImpl) SetPurgeInterval(v time.Duration)
- func (r *RateLimitConfigImpl) Verify() error
- type ServerClusterConfig
- type ServerClusterConfigImpl
- func (s *ServerClusterConfigImpl) GetNamespace() string
- func (s *ServerClusterConfigImpl) GetRefreshInterval() time.Duration
- func (s *ServerClusterConfigImpl) GetService() string
- func (s *ServerClusterConfigImpl) SetDefault()
- func (s *ServerClusterConfigImpl) SetNamespace(namespace string)
- func (s *ServerClusterConfigImpl) SetRefreshInterval(interval time.Duration)
- func (s *ServerClusterConfigImpl) SetService(service string)
- func (s *ServerClusterConfigImpl) Verify() error
- type ServerConnectorConfig
- type ServerConnectorConfigImpl
- func (s *ServerConnectorConfigImpl) GetAddresses() []string
- func (s *ServerConnectorConfigImpl) GetConnectTimeout() time.Duration
- func (s *ServerConnectorConfigImpl) GetConnectionIdleTimeout() time.Duration
- func (s *ServerConnectorConfigImpl) GetMessageTimeout() time.Duration
- func (s *ServerConnectorConfigImpl) GetPluginConfig(pluginName string) BaseConfig
- func (s *ServerConnectorConfigImpl) GetProtocol() string
- func (s *ServerConnectorConfigImpl) GetReconnectInterval() time.Duration
- func (s *ServerConnectorConfigImpl) GetRequestQueueSize() int32
- func (s *ServerConnectorConfigImpl) GetServerSwitchInterval() time.Duration
- func (s *ServerConnectorConfigImpl) Init()
- func (s *ServerConnectorConfigImpl) SetAddresses(addresses []string)
- func (s *ServerConnectorConfigImpl) SetConnectTimeout(timeout time.Duration)
- func (s *ServerConnectorConfigImpl) SetConnectionIdleTimeout(timeout time.Duration)
- func (s *ServerConnectorConfigImpl) SetDefault()
- func (s *ServerConnectorConfigImpl) SetMessageTimeout(timeout time.Duration)
- func (s *ServerConnectorConfigImpl) SetPluginConfig(pluginName string, value BaseConfig) error
- func (s *ServerConnectorConfigImpl) SetProtocol(protocol string)
- func (s *ServerConnectorConfigImpl) SetReconnectInterval(interval time.Duration)
- func (s *ServerConnectorConfigImpl) SetRequestQueueSize(queueSize int32)
- func (s *ServerConnectorConfigImpl) SetServerSwitchInterval(interval time.Duration)
- func (s *ServerConnectorConfigImpl) Verify() error
- type ServerServices
- type ServiceRouterConfig
- type ServiceRouterConfigImpl
- func (s *ServiceRouterConfigImpl) GetAfterChain() []string
- func (s *ServiceRouterConfigImpl) GetChain() []string
- func (s *ServiceRouterConfigImpl) GetNearbyConfig() NearbyConfig
- func (s *ServiceRouterConfigImpl) GetPercentOfMinInstances() float64
- func (s *ServiceRouterConfigImpl) GetPluginConfig(pluginName string) BaseConfig
- func (s *ServiceRouterConfigImpl) Init()
- func (s *ServiceRouterConfigImpl) IsEnableRecoverAll() bool
- func (s *ServiceRouterConfigImpl) SetAfterChain(chain []string)
- func (s *ServiceRouterConfigImpl) SetChain(chain []string)
- func (s *ServiceRouterConfigImpl) SetDefault()
- func (s *ServiceRouterConfigImpl) SetEnableRecoverAll(recoverAll bool)
- func (s *ServiceRouterConfigImpl) SetPercentOfMinInstances(percent float64)
- func (s *ServiceRouterConfigImpl) SetPluginConfig(pluginName string, value BaseConfig) error
- func (s *ServiceRouterConfigImpl) Verify() error
- type ServiceSpecific
- type ServiceSpecificConfig
- type ServicesSpecificImpl
- type StatReporterConfig
- type StatReporterConfigImpl
- func (s *StatReporterConfigImpl) GetChain() []string
- func (s *StatReporterConfigImpl) GetPluginConfig(name string) BaseConfig
- func (s *StatReporterConfigImpl) Init()
- func (s *StatReporterConfigImpl) IsEnable() bool
- func (s *StatReporterConfigImpl) SetChain(chain []string)
- func (s *StatReporterConfigImpl) SetDefault()
- func (s *StatReporterConfigImpl) SetEnable(enable bool)
- func (s *StatReporterConfigImpl) SetPluginConfig(plugName string, value BaseConfig) error
- func (s *StatReporterConfigImpl) Verify() error
- type SystemConfig
- type SystemConfigImpl
- func (s *SystemConfigImpl) GetDiscoverCluster() ServerClusterConfig
- func (s *SystemConfigImpl) GetHealthCheckCluster() ServerClusterConfig
- func (s *SystemConfigImpl) GetMode() model.RunMode
- func (s *SystemConfigImpl) GetMonitorCluster() ServerClusterConfig
- func (s *SystemConfigImpl) GetVariable(key string) (string, bool)
- func (s *SystemConfigImpl) Init()
- func (s *SystemConfigImpl) SetDefault()
- func (s *SystemConfigImpl) SetMode(mode model.RunMode)
- func (s *SystemConfigImpl) SetVariable(key, value string)
- func (s *SystemConfigImpl) UnsetVariable(key string)
- func (s *SystemConfigImpl) Verify() error
- type When
Constants ¶
const ( // HealthCheckNever never active health check. HealthCheckNever When = "never" // HealthCheckAlways always active health check. HealthCheckAlways = "always" // HealthCheckOnRecover active health check when instance has fail. HealthCheckOnRecover = "on_recover" )
const ( // DefaultAPIInvokeTimeout 默认API调用的超时时间. DefaultAPIInvokeTimeout = 1 * time.Second // DefaultAPIMaxRetryTimes 默认api调用重试次数. DefaultAPIMaxRetryTimes int = 1 // DefaultAPIRetryInterval 默认api调用重试间隔. DefaultAPIRetryInterval = 1 * time.Second // DefaultDiscoverServiceRetryInterval 默认首次发现discovery服务重试间隔. DefaultDiscoverServiceRetryInterval = 5 * time.Second // DefaultServiceExpireTime 默认的服务超时淘汰时间. DefaultServiceExpireTime = 24 * time.Hour // DefaultServiceRefreshIntervalDuration 默认的服务刷新间隔. DefaultServiceRefreshIntervalDuration = 2 * time.Second // DefaultServerConnectTimeout 默认SDK往Server连接超时时间间隔. DefaultServerConnectTimeout = 500 * time.Millisecond // DefaultReConnectInterval 默认重连的间隔. DefaultReConnectInterval = 500 * time.Millisecond // DefaultServerMessageTimeout 默认消息超时时间. DefaultServerMessageTimeout = 1500 * time.Millisecond // DefaultServerConnectionIdleTimeout 默认服务端stream闲置超时时间. DefaultServerConnectionIdleTimeout = 3 * time.Second // DefaultBuiltInServerConnectionCloseTimeout 默认埋点server连接过期关闭时间. DefaultBuiltInServerConnectionCloseTimeout = 2 * DefaultServerConnectionIdleTimeout // DefaultRequestQueueSize 默认发送队列的buffer大小,支持的最大瞬时并发度,默认1000. DefaultRequestQueueSize int = 1000 // DefaultServerSwitchInterval 默认server的切换时间时间. DefaultServerSwitchInterval = 10 * time.Minute // DefaultCachePersistDir 默认缓存持久化存储目录. DefaultCachePersistDir string = "./polaris/backup" // DefaultPersistMaxWriteRetry 持久化缓存写文件的默认重试次数. DefaultPersistMaxWriteRetry int = 5 // DefaultPersistMaxReadRetry 读取持久化缓存的默认重试次数. DefaultPersistMaxReadRetry = 1 // DefaultPersistRetryInterval 默认持久化重试间隔时间. DefaultPersistRetryInterval = 1 * time.Second // DefaultPersistAvailableInterval 默认持久化文件有效时间. DefaultPersistAvailableInterval = 60 * time.Second // DefaultCircuitBreakerCheckPeriod 默认熔断节点检查周期. DefaultCircuitBreakerCheckPeriod = 10 * time.Second // MinCircuitBreakerCheckPeriod 最低熔断节点检查周期. MinCircuitBreakerCheckPeriod = 1 * time.Second // DefaultCircuitBreakerEnabled 熔断器默认开启与否. DefaultCircuitBreakerEnabled bool = true // DefaultRecoverAllEnabled 服务路由的全死全活默认开启与否. DefaultRecoverAllEnabled bool = true // DefaultPercentOfMinInstances 路由至少返回节点数百分比. DefaultPercentOfMinInstances float64 = 0.0 // DefaultHealthCheckConcurrency 默认心跳检测的并发数. DefaultHealthCheckConcurrency int = 1 // DefaultHealthCheckConcurrencyAlways 默认持续心跳检测的并发数. DefaultHealthCheckConcurrencyAlways int = 10 // DefaultHealthCheckInterval 默认健康探测周期. DefaultHealthCheckInterval = 10 * time.Second // MinHealthCheckInterval 最低健康探测周期. MinHealthCheckInterval = 500 * time.Millisecond // DefaultHealthCheckTimeout 默认健康探测超时时间. DefaultHealthCheckTimeout = 100 * time.Millisecond // DefaultReportClientIntervalDuration 客户端信息上报周期,默认2分钟. DefaultReportClientIntervalDuration = 2 * time.Minute // MaxRedirectTimes 最大重定向次数,默认1. MaxRedirectTimes = 1 // DefaultReportSDKConfigurationInterval sdk配置上报周期. DefaultReportSDKConfigurationInterval = 5 * time.Minute // DefaultSleepWindow 熔断周期,被熔断后多久变为半开. DefaultSleepWindow = 30 * time.Second // MinSleepWindow 最小熔断周期,1s. MinSleepWindow = 1 * time.Second // DefaultRecoverWindow 默认恢复周期,半开后按多久的统计窗口进行恢复统计. DefaultRecoverWindow = 60 * time.Second // MinRecoverWindow 最小恢复周期,10s. MinRecoverWindow = 10 * time.Second // DefaultRecoverNumBuckets 默认恢复统计的滑桶数. DefaultRecoverNumBuckets = 10 // MinRecoverNumBuckets 最小恢复统计的滑桶数. MinRecoverNumBuckets = 1 // DefaultRequestCountAfterHalfOpen 半开状态后分配的探测请求数. DefaultRequestCountAfterHalfOpen = 10 // DefaultSuccessCountAfterHalfOpen 半开状态后恢复的成功请求数. DefaultSuccessCountAfterHalfOpen = 8 // DefaultRateLimitWindowCount 限流上报时间窗数量,上报间隔=时间间隔/时间窗数量. DefaultRateLimitWindowCount = 10 // MinRateLimitReportInterval 最小限流上报周期. MinRateLimitReportInterval = 10 * time.Millisecond // DefaultRateLimitAcquireInterval 限流默认和sever acquire配额间隔, 弃用. DefaultRateLimitAcquireInterval = 100 * time.Millisecond // MaxRateLimitReportInterval 最大限流上报周期, 弃用. MaxRateLimitReportInterval = 5 * time.Second // DefaultRateLimitReportAmountPresent 默认满足百分之80的请求后立刻限流上报. DefaultRateLimitReportAmountPresent = 80 // MaxRateLimitReportAmountPresent 最大实时上报百分比. MaxRateLimitReportAmountPresent = 100 // MinRateLimitReportAmountPresent 最小实时上报百分比. MinRateLimitReportAmountPresent = 0 // DefaultNamesSeparator 默认的名字分隔符. DefaultNamesSeparator = "#" // DefaultMapKeyValueSeparator 默认Map组装str key value分割符. DefaultMapKeyValueSeparator = ":" // DefaultMapKVTupleSeparator 默认Map组装str (key:value) 二元组分割符. DefaultMapKVTupleSeparator = "|" // DefaultLocationProvider 默认实例地理位置提供者插件名称. DefaultLocationProvider = "" // DefaultPropertiesValueCacheSize 默认类型转化缓存的key数量. DefaultPropertiesValueCacheSize = 100 // DefaultPropertiesValueExpireTime 默认类型转化缓存的过期时间,1分钟. DefaultPropertiesValueExpireTime = 60000 // DefaultConnectorType 默认连接器类型. DefaultConnectorType = "polaris" // DefaultConfigConnectorAddresses 默认连接器类型. DefaultConfigConnectorAddresses = "127.0.0.1:8093" // DefaultMinRegisterInterval DefaultMinRegisterInterval = 30 * time.Second // DefaultConfigFilterEnabled 默认配置过滤是否开启 DefaultConfigFilterEnabled bool = true )
const ( // DefaultServerConnector 默认的服务端连接器插件. DefaultServerConnector string = "grpc" // DefaultLocalCache 默认本地缓存策略. DefaultLocalCache string = "inmemory" // DefaultServiceRouterRuleBased 默认规则路由. DefaultServiceRouterRuleBased string = "ruleBasedRouter" // DefaultServiceRouterFilterOnly 默认只过滤健康实例的路由. DefaultServiceRouterFilterOnly string = "filterOnlyRouter" // DefaultServiceRouterNearbyBased 默认就近路由. DefaultServiceRouterNearbyBased string = "nearbyBasedRouter" // DefaultServiceRouterSetDivision 默认set分组. DefaultServiceRouterSetDivision string = "setDivisionRouter" // DefaultServiceRouterDstMeta 默认基于目标元数据路由. DefaultServiceRouterDstMeta string = "dstMetaRouter" // DefaultServiceRouterCanary 金丝雀路由. DefaultServiceRouterCanary string = "canaryRouter" // DefaultServiceRouterZeroProtect 零实例保护 DefaultServiceRouterZeroProtect string = "zeroProtectRouter" // DefaultLoadBalancerWR 默认负载均衡器,权重随机. DefaultLoadBalancerWR string = "weightedRandom" // DefaultLoadBalancerRingHash 负载均衡器,一致性hash环. DefaultLoadBalancerRingHash string = "ringHash" // DefaultLoadBalancerMaglev 负载均衡器,maglev hash. DefaultLoadBalancerMaglev string = "maglev" // DefaultLoadBalancerL5CST 负载均衡器,l5一致性hash兼容. DefaultLoadBalancerL5CST string = "l5cst" // DefaultLoadBalancerHash 负载均衡器,普通hash. DefaultLoadBalancerHash string = "hash" // DefaultCircuitBreakerErrRate 默认错误率熔断器. DefaultCircuitBreakerErrRate string = "errorRate" // DefaultCircuitBreakerErrCount 默认持续错误熔断器. DefaultCircuitBreakerErrCount string = "errorCount" // DefaultCircuitBreakerErrCheck 默认错误探测熔断器. DefaultCircuitBreakerErrCheck string = "errorCheck" // DefaultTCPHealthCheck 默认TCP探测器. DefaultTCPHealthCheck string = "tcp" // DefaultUDPHealthCheck 默认UDP探测器. DefaultUDPHealthCheck string = "udp" // DefaultRejectRateLimiter 默认的reject限流器. DefaultRejectRateLimiter = "reject" // DefaultWarmUpRateLimiter 默认warmup限流器. DefaultWarmUpRateLimiter = "warmUp" // DefaultUniformRateLimiter 默认的匀速限流器. DefaultUniformRateLimiter = "unirate" // DefaultWarmUpWaitLimiter 默认限流插件,预热匀速. DefaultWarmUpWaitLimiter = "warmup-wait" // SubscribeLocalChannel 默认订阅事件处理插件. SubscribeLocalChannel = "subscribeLocalChannel" // MaxRateLimitWindowSize 默认限流最大窗口数量. MaxRateLimitWindowSize = 20000 // DefaultRateLimitPurgeInterval 默认超时清理时延. DefaultRateLimitPurgeInterval = 1 * time.Minute // DefaultConfigConnector 默认的注册中心连接器插件. DefaultConfigConnector string = "polaris" // DefaultLimiterNamespace 默认的限流服务 DefaultLimiterNamespace string = "Polaris" // DefaultLimiterService 默认的限流服务 DefaultLimiterService string = "polaris.limiter" )
const ( DefaultMatchLevel = "zone" RegionLevel = "region" ZoneLevel = "zone" CampusLevel = "campus" AllLevel = "" )
默认的就近路由配置.
const ( // DefaultStatReporter . DefaultStatReporter = "stat2Monitor" // DefaultCacheReporter . DefaultCacheReporter = "serviceCache" // DefaultPluginReporter . DefaultPluginReporter = "pluginInfo" // DefaultLoadBalanceReporter . DefaultLoadBalanceReporter = "lbInfo" // DefaultRateLimitReporter . DefaultRateLimitReporter = "rateLimitRecord" // DefaultServiceRouteReporter . DefaultServiceRouteReporter = "serviceRoute" // DefaultStatReportEnabled . DefaultStatReportEnabled = true // DefaultMetricsChain . DefaultMetricsChain = "prometheus" )
const ( // DefaultMinServiceExpireTime . DefaultMinServiceExpireTime = 5 * time.Second // DefaultMaxServiceExpireCheckTime . DefaultMaxServiceExpireCheckTime = 1 * time.Hour // DefaultMinTimingInterval . DefaultMinTimingInterval = 100 * time.Millisecond // DefaultServerServiceRefreshInterval . DefaultServerServiceRefreshInterval = 1 * time.Minute )
const ( ServerNamespace = "Polaris" ServerDiscoverService = "polaris.discover" ServerHeartBeatService = "polaris.healthcheck" ServerMonitorService = "polaris.monitor" ServerConfigService = "polaris.config" )
默认注册中心服务名.
const (
// DefaultConfigFile 系统默认配置文件.
DefaultConfigFile = "./polaris.yaml"
)
const ForbidServerMetricService = "polaris.metric"
ForbidServerMetricService 已经禁用的限流集群名.
Variables ¶
var ( DefaultServerServiceRouterChain = []string{DefaultServiceRouterDstMeta, DefaultServiceRouterNearbyBased} // DefaultPolarisServicesRouterChain 系统命名空间下的服务默认路由链. DefaultPolarisServicesRouterChain = []string{DefaultServiceRouterDstMeta} DefaultServerServiceToLoadBalancer = map[ClusterType]string{ DiscoverCluster: DefaultLoadBalancerWR, ConfigCluster: DefaultLoadBalancerWR, HealthCheckCluster: DefaultLoadBalancerMaglev, MonitorCluster: DefaultLoadBalancerMaglev, } DefaultServerServiceToUseDefault = map[ClusterType]bool{ DiscoverCluster: true, HealthCheckCluster: true, } )
系统服务相关变量.
var ( // DefaultUseFileCacheFlag 默认启动后,首次名字服务是否可以使用缓存文件 DefaultUseFileCacheFlag = true // DefaultPushEmptyProtection 推空保护默认关闭 DefaultPushEmptyProtection = false )
var DefaultConfigFileEnable = true
DefaultConfigFileEnable 默认打开配置中心能力
var DefaultRateLimitEnable = true
DefaultRateLimitEnable 默认打开限流能力
Functions ¶
func GetContainerNameEnvList ¶
func GetContainerNameEnvList() []string
GetContainerNameEnvList 获取可以从获取的容器.
func RegisterPluginConfigType ¶
func RegisterPluginConfigType(typ common.Type, name string, cfg BaseConfig)
RegisterPluginConfigType RegisterPlugin 注册插件到全局配置对象,并注册插件配置类型.
func ServiceClusterToServiceKey ¶
func ServiceClusterToServiceKey(config ServerClusterConfig) model.ServiceKey
ServiceClusterToServiceKey 服务集群信息转换为服务对象.
Types ¶
type APIConfig ¶
type APIConfig interface { BaseConfig // GetTimeout global.api.timeout // 默认调用超时时间 GetTimeout() time.Duration // SetTimeout 设置默认调用超时时间 SetTimeout(time.Duration) // GetBindIntf global.api.bindIf // 默认客户端绑定的网卡地址 GetBindIntf() string // SetBindIntf 设置默认客户端绑定的网卡地址 SetBindIntf(string) // GetBindIP global.api.bindIP // 默认客户端绑定的IP地址 GetBindIP() string // SetBindIP 设置默认客户端绑定的IP地址 SetBindIP(string) // GetReportInterval global.api.reportInterval // 默认客户端定时上报周期 GetReportInterval() time.Duration // SetReportInterval 设置默认客户端定时上报周期 SetReportInterval(time.Duration) // GetMaxRetryTimes global.api.maxRetryTimes // api调用最多重试时间 GetMaxRetryTimes() int // SetMaxRetryTimes 设置api调用最多重试时间 SetMaxRetryTimes(int) // GetRetryInterval global.api.retryInterval // api调用重试时间 GetRetryInterval() time.Duration // SetRetryInterval 设置api调用重试时间 SetRetryInterval(time.Duration) }
APIConfig api相关的配置对象.
type APIConfigImpl ¶
type APIConfigImpl struct { Timeout *time.Duration `yaml:"timeout" json:"timeout"` BindIntf string `yaml:"bindIf" json:"bindIf"` BindIP string `yaml:"bindIP" json:"bindIP"` BindIPValue string `yaml:"-" json:"-"` ReportInterval *time.Duration `yaml:"reportInterval" json:"reportInterval"` MaxRetryTimes int `yaml:"maxRetryTimes" json:"maxRetryTimes"` RetryInterval *time.Duration `yaml:"retryInterval" json:"retryInterval"` }
APIConfigImpl API访问相关的配置.
func (*APIConfigImpl) GetBindIP ¶
func (a *APIConfigImpl) GetBindIP() string
GetBindIP 默认客户端绑定的网卡地址.
func (*APIConfigImpl) GetBindIntf ¶
func (a *APIConfigImpl) GetBindIntf() string
GetBindIntf 默认客户端绑定的网卡地址.
func (*APIConfigImpl) GetMaxRetryTimes ¶
func (a *APIConfigImpl) GetMaxRetryTimes() int
GetMaxRetryTimes 最大重试次数.
func (*APIConfigImpl) GetReportInterval ¶
func (a *APIConfigImpl) GetReportInterval() time.Duration
GetReportInterval 默认客户端上报周期.
func (*APIConfigImpl) GetRetryInterval ¶
func (a *APIConfigImpl) GetRetryInterval() time.Duration
GetRetryInterval 重试周期.
func (*APIConfigImpl) GetTimeout ¶
func (a *APIConfigImpl) GetTimeout() time.Duration
GetTimeout 默认调用超时时间.
func (*APIConfigImpl) SetBindIP ¶
func (a *APIConfigImpl) SetBindIP(bindIPValue string)
SetBindIP 设置默认客户端绑定的网卡地址.
func (*APIConfigImpl) SetBindIntf ¶
func (a *APIConfigImpl) SetBindIntf(bindIntf string)
SetBindIntf 设置默认客户端绑定的网卡地址.
func (*APIConfigImpl) SetMaxRetryTimes ¶
func (a *APIConfigImpl) SetMaxRetryTimes(maxRetryTimes int)
SetMaxRetryTimes 最大重试次数.
func (*APIConfigImpl) SetReportInterval ¶
func (a *APIConfigImpl) SetReportInterval(interval time.Duration)
SetReportInterval 设置默认客户端上报周期.
func (*APIConfigImpl) SetRetryInterval ¶
func (a *APIConfigImpl) SetRetryInterval(interval time.Duration)
SetRetryInterval 重试周期.
func (*APIConfigImpl) SetTimeout ¶
func (a *APIConfigImpl) SetTimeout(timeout time.Duration)
SetTimeout 设置默认超时时间.
type BaseConfig ¶
type BaseConfig interface { // Verify 校验配置是否OK Verify() error // SetDefault 对关键值设置默认值 SetDefault() }
BaseConfig 自身自带校验器的配置集合.
type CircuitBreakerConfig ¶
type CircuitBreakerConfig interface { BaseConfig PluginConfig // IsEnable 是否启用熔断 IsEnable() bool // SetEnable 设置是否启用熔断 SetEnable(bool) // GetChain 熔断器插件链 GetChain() []string // SetChain 设置熔断器插件链 SetChain([]string) // GetCheckPeriod 熔断器定时检测时间 GetCheckPeriod() time.Duration // SetCheckPeriod 设置熔断器定时检测时间 SetCheckPeriod(time.Duration) // GetSleepWindow 获取熔断周期 GetSleepWindow() time.Duration // SetSleepWindow 设置熔断周期 SetSleepWindow(interval time.Duration) // GetRequestCountAfterHalfOpen 获取半开状态后最多分配多少个探测请求 GetRequestCountAfterHalfOpen() int // SetRequestCountAfterHalfOpen 设置半开状态后最多分配多少个探测请求 SetRequestCountAfterHalfOpen(count int) // GetSuccessCountAfterHalfOpen 获取半开状态后多少个成功请求则恢复 GetSuccessCountAfterHalfOpen() int // SetSuccessCountAfterHalfOpen 设置半开状态后多少个成功请求则恢复 SetSuccessCountAfterHalfOpen(count int) // GetRecoverWindow 获取半开后的恢复周期,按周期来进行半开放量的统计 GetRecoverWindow() time.Duration // SetRecoverWindow 设置半开后的恢复周期,按周期来进行半开放量的统计 SetRecoverWindow(value time.Duration) // GetRecoverNumBuckets 半开后请求数统计滑桶数量 GetRecoverNumBuckets() int // SetRecoverNumBuckets 设置半开后请求数统计滑桶数量 SetRecoverNumBuckets(value int) // GetErrorCountConfig 连续错误数熔断配置 GetErrorCountConfig() ErrorCountConfig // GetErrorRateConfig 错误率熔断配置 GetErrorRateConfig() ErrorRateConfig }
CircuitBreakerConfig 熔断相关的配置项.
type CircuitBreakerConfigImpl ¶
type CircuitBreakerConfigImpl struct { // Enable 是否启动熔断 Enable *bool `yaml:"enable" json:"enable"` // CheckPeriod 熔断器定时检查周期 CheckPeriod *time.Duration `yaml:"checkPeriod" json:"checkPeriod"` // Chain 熔断插件链 Chain []string `yaml:"chain"` // SleepWindow 熔断周期,被熔断后多久可以变为半开 SleepWindow *time.Duration `yaml:"sleepWindow" json:"sleepWindow"` // RequestCountAfterHalfOpen 半开状态后最多分配多少个探测请求 RequestCountAfterHalfOpen int `yaml:"requestCountAfterHalfOpen" json:"requestCountAfterHalfOpen"` // SuccessCountAfterHalfOpen 半开状态后多少个成功请求则恢复 SuccessCountAfterHalfOpen int `yaml:"successCountAfterHalfOpen" json:"successCountAfterHalfOpen"` // RecoverWindow 半开后的恢复周期,在这个周期内统计成功数 RecoverWindow *time.Duration `yaml:"recoverWindow" json:"recoverWindow"` // RecoverNumBuckets 半开后的统计的滑窗数 RecoverNumBuckets int `yaml:"recoverNumBuckets" json:"recoverNumBuckets"` // Plugin 插件配置反序列化后的对象 Plugin PluginConfigs `yaml:"plugin" json:"plugin"` }
CircuitBreakerConfigImpl 熔断相关配置
func (*CircuitBreakerConfigImpl) GetChain ¶
func (c *CircuitBreakerConfigImpl) GetChain() []string
GetChain 熔断器插件链
func (*CircuitBreakerConfigImpl) GetCheckPeriod ¶
func (c *CircuitBreakerConfigImpl) GetCheckPeriod() time.Duration
GetCheckPeriod 熔断器定时检测时间
func (*CircuitBreakerConfigImpl) GetErrorCountConfig ¶
func (c *CircuitBreakerConfigImpl) GetErrorCountConfig() ErrorCountConfig
GetErrorCountConfig 获取连续错误数熔断配置
func (*CircuitBreakerConfigImpl) GetErrorRateConfig ¶
func (c *CircuitBreakerConfigImpl) GetErrorRateConfig() ErrorRateConfig
GetErrorRateConfig 错误率熔断配置
func (*CircuitBreakerConfigImpl) GetPluginConfig ¶
func (c *CircuitBreakerConfigImpl) GetPluginConfig(pluginName string) BaseConfig
GetPluginConfig 获取一个熔断器插件配置
func (*CircuitBreakerConfigImpl) GetRecoverNumBuckets ¶
func (c *CircuitBreakerConfigImpl) GetRecoverNumBuckets() int
GetRecoverNumBuckets 半开后请求数统计滑桶数量
func (*CircuitBreakerConfigImpl) GetRecoverWindow ¶
func (c *CircuitBreakerConfigImpl) GetRecoverWindow() time.Duration
GetRecoverWindow 获取半开后的恢复周期,按周期来进行半开放量的统计
func (*CircuitBreakerConfigImpl) GetRequestCountAfterHalfOpen ¶
func (c *CircuitBreakerConfigImpl) GetRequestCountAfterHalfOpen() int
GetRequestCountAfterHalfOpen 获取半开状态后最多分配多少个探测请求
func (*CircuitBreakerConfigImpl) GetSleepWindow ¶
func (c *CircuitBreakerConfigImpl) GetSleepWindow() time.Duration
GetSleepWindow 获取熔断周期
func (*CircuitBreakerConfigImpl) GetSuccessCountAfterHalfOpen ¶
func (c *CircuitBreakerConfigImpl) GetSuccessCountAfterHalfOpen() int
GetSuccessCountAfterHalfOpen 获取半开状态后多少个成功请求则恢复
func (*CircuitBreakerConfigImpl) Init ¶
func (c *CircuitBreakerConfigImpl) Init()
Init 初始化CircuitBreakerConfigImpl配置
func (*CircuitBreakerConfigImpl) IsEnable ¶
func (c *CircuitBreakerConfigImpl) IsEnable() bool
IsEnable 是否启用熔断
func (*CircuitBreakerConfigImpl) SetChain ¶
func (c *CircuitBreakerConfigImpl) SetChain(chain []string)
SetChain 设置熔断器插件链
func (*CircuitBreakerConfigImpl) SetCheckPeriod ¶
func (c *CircuitBreakerConfigImpl) SetCheckPeriod(period time.Duration)
SetCheckPeriod 设置熔断器定时检测时间
func (*CircuitBreakerConfigImpl) SetDefault ¶
func (c *CircuitBreakerConfigImpl) SetDefault()
SetDefault 设置CircuitBreakerConfigImpl配置的默认值
func (*CircuitBreakerConfigImpl) SetEnable ¶
func (c *CircuitBreakerConfigImpl) SetEnable(enable bool)
SetEnable 设置是否启用熔断
func (*CircuitBreakerConfigImpl) SetPluginConfig ¶
func (c *CircuitBreakerConfigImpl) SetPluginConfig(pluginName string, value BaseConfig) error
SetPluginConfig 设置一个熔断器插件配置
func (*CircuitBreakerConfigImpl) SetRecoverNumBuckets ¶
func (c *CircuitBreakerConfigImpl) SetRecoverNumBuckets(value int)
SetRecoverNumBuckets 设置半开后请求数统计滑桶数量
func (*CircuitBreakerConfigImpl) SetRecoverWindow ¶
func (c *CircuitBreakerConfigImpl) SetRecoverWindow(value time.Duration)
SetRecoverWindow 设置半开后的恢复周期,按周期来进行半开放量的统计
func (*CircuitBreakerConfigImpl) SetRequestCountAfterHalfOpen ¶
func (c *CircuitBreakerConfigImpl) SetRequestCountAfterHalfOpen(count int)
SetRequestCountAfterHalfOpen 设置半开状态后最多分配多少个探测请求
func (*CircuitBreakerConfigImpl) SetSleepWindow ¶
func (c *CircuitBreakerConfigImpl) SetSleepWindow(interval time.Duration)
SetSleepWindow 设置熔断周期
func (*CircuitBreakerConfigImpl) SetSuccessCountAfterHalfOpen ¶
func (c *CircuitBreakerConfigImpl) SetSuccessCountAfterHalfOpen(count int)
SetSuccessCountAfterHalfOpen 设置半开状态后多少个成功请求则恢复
func (*CircuitBreakerConfigImpl) Verify ¶
func (c *CircuitBreakerConfigImpl) Verify() error
Verify 检验LocalCacheConfig配置
type ClusterService ¶
type ClusterService struct { model.ServiceKey ClusterType ClusterType ClusterConfig ServerClusterConfig }
ClusterService server集群服务信息.
type ClusterType ¶
type ClusterType string
ClusterType 集群类型,用以标识系统服务集群.
const ( BuiltinCluster ClusterType = "builtin" DiscoverCluster ClusterType = "discover" ConfigCluster ClusterType = "config" HealthCheckCluster ClusterType = "healthCheck" MonitorCluster ClusterType = "monitor" )
默认集群类型.
type ConfigConnectorConfig ¶ added in v1.1.0
type ConfigConnectorConfig interface { ServerConnectorConfig // GetConnectorType 后端服务器类型,默认是 polaris GetConnectorType() string }
ConfigConnectorConfig 配置中心连接相关的配置.
type ConfigConnectorConfigImpl ¶ added in v1.1.0
type ConfigConnectorConfigImpl struct { Addresses []string `yaml:"addresses" json:"addresses"` Protocol string `yaml:"protocol" json:"protocol"` ConnectTimeout *time.Duration `yaml:"connectTimeout" json:"connectTimeout"` // 远程请求超时时间 MessageTimeout *time.Duration `yaml:"messageTimeout" json:"messageTimeout"` ConnectionIdleTimeout *time.Duration `yaml:"connectionIdleTimeout" json:"connectionIdleTimeout"` RequestQueueSize *int32 `yaml:"requestQueueSize" json:"requestQueueSize"` ServerSwitchInterval *time.Duration `yaml:"serverSwitchInterval" json:"serverSwitchInterval"` ReconnectInterval *time.Duration `yaml:"reconnectInterval" json:"reconnectInterval"` Plugin PluginConfigs `yaml:"plugin" json:"plugin"` ConnectorType string `yaml:"connectorType" json:"connectorType"` }
ConfigConnectorConfigImpl 对接配置中心连接器相关配置.
func (*ConfigConnectorConfigImpl) GetAddresses ¶ added in v1.1.0
func (c *ConfigConnectorConfigImpl) GetAddresses() []string
GetAddresses config.configConnector.addresses.
func (*ConfigConnectorConfigImpl) GetConnectTimeout ¶ added in v1.1.0
func (c *ConfigConnectorConfigImpl) GetConnectTimeout() time.Duration
GetConnectTimeout config.configConnector.connectTimeout.
func (*ConfigConnectorConfigImpl) GetConnectionIdleTimeout ¶ added in v1.1.0
func (c *ConfigConnectorConfigImpl) GetConnectionIdleTimeout() time.Duration
GetConnectionIdleTimeout config.configConnector.connectionIdleTimeout.
func (*ConfigConnectorConfigImpl) GetConnectorType ¶ added in v1.1.0
func (c *ConfigConnectorConfigImpl) GetConnectorType() string
GetConnectorType 获取连接器类型.
func (*ConfigConnectorConfigImpl) GetMessageTimeout ¶ added in v1.1.0
func (c *ConfigConnectorConfigImpl) GetMessageTimeout() time.Duration
GetMessageTimeout config.configConnector.messageTimeout.
func (*ConfigConnectorConfigImpl) GetPluginConfig ¶ added in v1.1.0
func (c *ConfigConnectorConfigImpl) GetPluginConfig(pluginName string) BaseConfig
GetPluginConfig config.configConnector.plugin.
func (*ConfigConnectorConfigImpl) GetProtocol ¶ added in v1.1.0
func (c *ConfigConnectorConfigImpl) GetProtocol() string
GetProtocol config.configConnector.protocol.
func (*ConfigConnectorConfigImpl) GetReconnectInterval ¶ added in v1.1.0
func (c *ConfigConnectorConfigImpl) GetReconnectInterval() time.Duration
GetReconnectInterval 一次连接失败后,到下一次连接之间的最小间隔时间.
func (*ConfigConnectorConfigImpl) GetRequestQueueSize ¶ added in v1.1.0
func (c *ConfigConnectorConfigImpl) GetRequestQueueSize() int32
GetRequestQueueSize config.configConnector.requestQueueSize.
func (*ConfigConnectorConfigImpl) GetServerSwitchInterval ¶ added in v1.1.0
func (c *ConfigConnectorConfigImpl) GetServerSwitchInterval() time.Duration
GetServerSwitchInterval config.configConnector.serverSwitchInterval.
func (*ConfigConnectorConfigImpl) Init ¶ added in v1.1.0
func (c *ConfigConnectorConfigImpl) Init()
Init 配置初始化.
func (*ConfigConnectorConfigImpl) SetAddresses ¶ added in v1.1.0
func (c *ConfigConnectorConfigImpl) SetAddresses(addresses []string)
SetAddresses 设置远端server地址,格式为<host>:<port>.
func (*ConfigConnectorConfigImpl) SetConnectTimeout ¶ added in v1.1.0
func (c *ConfigConnectorConfigImpl) SetConnectTimeout(timeout time.Duration)
SetConnectTimeout 设置与server的连接超时时间.
func (*ConfigConnectorConfigImpl) SetConnectionIdleTimeout ¶ added in v1.1.0
func (c *ConfigConnectorConfigImpl) SetConnectionIdleTimeout(timeout time.Duration)
SetConnectionIdleTimeout 设置连接空闲后超时时间.
func (*ConfigConnectorConfigImpl) SetConnectorType ¶ added in v1.1.0
func (c *ConfigConnectorConfigImpl) SetConnectorType(connectorType string)
SetConnectorType 设置连接器类型.
func (*ConfigConnectorConfigImpl) SetDefault ¶ added in v1.1.0
func (c *ConfigConnectorConfigImpl) SetDefault()
SetDefault 设置ConfigConnector配置的默认值.
func (*ConfigConnectorConfigImpl) SetMessageTimeout ¶ added in v1.1.0
func (c *ConfigConnectorConfigImpl) SetMessageTimeout(timeout time.Duration)
SetMessageTimeout 设置远程请求超时时间.
func (*ConfigConnectorConfigImpl) SetPluginConfig ¶ added in v1.1.0
func (c *ConfigConnectorConfigImpl) SetPluginConfig(pluginName string, value BaseConfig) error
SetPluginConfig 输出插件具体配置.
func (*ConfigConnectorConfigImpl) SetProtocol ¶ added in v1.1.0
func (c *ConfigConnectorConfigImpl) SetProtocol(protocol string)
SetProtocol 设置与server对接的协议.
func (*ConfigConnectorConfigImpl) SetReconnectInterval ¶ added in v1.1.0
func (c *ConfigConnectorConfigImpl) SetReconnectInterval(interval time.Duration)
SetReconnectInterval 一次连接失败后,到下一次连接之间的最小间隔时间.
func (*ConfigConnectorConfigImpl) SetRequestQueueSize ¶ added in v1.1.0
func (c *ConfigConnectorConfigImpl) SetRequestQueueSize(queueSize int32)
SetRequestQueueSize 设置新请求的队列BUFFER容量.
func (*ConfigConnectorConfigImpl) SetServerSwitchInterval ¶ added in v1.1.0
func (c *ConfigConnectorConfigImpl) SetServerSwitchInterval(interval time.Duration)
SetServerSwitchInterval 设置server的切换时延.
func (*ConfigConnectorConfigImpl) Verify ¶ added in v1.1.0
func (c *ConfigConnectorConfigImpl) Verify() error
Verify 检验ConfigConnector配置.
type ConfigFileConfig ¶ added in v1.1.0
type ConfigFileConfig interface { BaseConfig // IsEnable 是否启用配置中心 IsEnable() bool // GetConfigConnectorConfig 配置文件连接器 GetConfigConnectorConfig() ConfigConnectorConfig // GetConfigFilterConfig 配置文件加密器 GetConfigFilterConfig() ConfigFilterConfig // GetPropertiesValueCacheSize 值缓存的最大数量 GetPropertiesValueCacheSize() int32 // GetPropertiesValueExpireTime 缓存的过期时间,默认为 60s GetPropertiesValueExpireTime() int64 }
ConfigFileConfig 配置中心的配置.
type ConfigFileConfigImpl ¶ added in v1.1.0
type ConfigFileConfigImpl struct { ConfigConnectorConfig *ConfigConnectorConfigImpl `yaml:"configConnector" json:"configConnector"` ConfigFilterConfig *ConfigFilterConfigImpl `yaml:"configFilter" json:"configFilter"` // 是否启动配置中心 Enable *bool `yaml:"enable" json:"enable"` PropertiesValueCacheSize *int32 `yaml:"propertiesValueCacheSize" json:"propertiesValueCacheSize"` PropertiesValueExpireTime *int64 `yaml:"propertiesValueExpireTime" json:"propertiesValueExpireTime"` }
ConfigFileConfigImpl 对接配置中心相关配置.
func (*ConfigFileConfigImpl) GetConfigConnectorConfig ¶ added in v1.1.0
func (c *ConfigFileConfigImpl) GetConfigConnectorConfig() ConfigConnectorConfig
GetConfigConnectorConfig config.configConnector前缀开头的所有配置项.
func (*ConfigFileConfigImpl) GetConfigFilterConfig ¶ added in v1.5.0
func (c *ConfigFileConfigImpl) GetConfigFilterConfig() ConfigFilterConfig
GetConfigFilterConfig config.configFilter前缀开头的所有配置项.
func (*ConfigFileConfigImpl) GetPropertiesValueCacheSize ¶ added in v1.1.0
func (c *ConfigFileConfigImpl) GetPropertiesValueCacheSize() int32
GetPropertiesValueCacheSize config.propertiesValueCacheSize.
func (*ConfigFileConfigImpl) GetPropertiesValueExpireTime ¶ added in v1.1.0
func (c *ConfigFileConfigImpl) GetPropertiesValueExpireTime() int64
GetPropertiesValueExpireTime config.propertiesValueExpireTime.
func (*ConfigFileConfigImpl) Init ¶ added in v1.1.0
func (c *ConfigFileConfigImpl) Init()
Init 配置初始化.
func (*ConfigFileConfigImpl) IsEnable ¶ added in v1.1.0
func (c *ConfigFileConfigImpl) IsEnable() bool
IsEnable config.enable.
func (*ConfigFileConfigImpl) SetDefault ¶ added in v1.1.0
func (c *ConfigFileConfigImpl) SetDefault()
SetDefault 设置ConfigConnector配置的默认值.
func (*ConfigFileConfigImpl) SetEnable ¶ added in v1.1.0
func (c *ConfigFileConfigImpl) SetEnable(enable bool)
SetEnable 设置是否开启配置中心功能.
func (*ConfigFileConfigImpl) SetPropertiesValueCacheSize ¶ added in v1.1.0
func (c *ConfigFileConfigImpl) SetPropertiesValueCacheSize(propertiesValueCacheSize int32)
SetPropertiesValueCacheSize 设置类型转化缓存的key数量.
func (*ConfigFileConfigImpl) SetPropertiesValueExpireTime ¶ added in v1.1.0
func (c *ConfigFileConfigImpl) SetPropertiesValueExpireTime(propertiesValueExpireTime int64)
SetPropertiesValueExpireTime 设置类型转化缓存的过期时间,默认为1分钟.
func (*ConfigFileConfigImpl) Verify ¶ added in v1.1.0
func (c *ConfigFileConfigImpl) Verify() error
Verify 检验ConfigConnector配置.
type ConfigFilterConfig ¶ added in v1.5.0
type ConfigFilterConfig interface { BaseConfig PluginConfig IsEnable() bool GetChain() []string }
ConfigFilterConfig 配置中心加密相关配置
type ConfigFilterConfigImpl ¶ added in v1.5.0
type ConfigFilterConfigImpl struct { Enable *bool `yaml:"enable" json:"enable"` Chain []string `yaml:"chain" json:"chain"` Plugin PluginConfigs `yaml:"plugin" json:"plugin"` }
ConfigFilterConfigImpl 配置过滤器配置
func (*ConfigFilterConfigImpl) GetChain ¶ added in v1.5.0
func (c *ConfigFilterConfigImpl) GetChain() []string
GetChain get config filter chain
func (*ConfigFilterConfigImpl) GetPluginConfig ¶ added in v1.5.0
func (c *ConfigFilterConfigImpl) GetPluginConfig(pluginName string) BaseConfig
GetPluginConfig get config filter plugin
func (*ConfigFilterConfigImpl) Init ¶ added in v1.5.0
func (c *ConfigFilterConfigImpl) Init()
Init init config filter
func (*ConfigFilterConfigImpl) IsEnable ¶ added in v1.5.0
func (c *ConfigFilterConfigImpl) IsEnable() bool
IsEnable is enable config filter
func (*ConfigFilterConfigImpl) SetChain ¶ added in v1.5.0
func (c *ConfigFilterConfigImpl) SetChain(chain []string)
SetChain set config filter chain
func (*ConfigFilterConfigImpl) SetDefault ¶ added in v1.5.0
func (c *ConfigFilterConfigImpl) SetDefault()
SetDefault set default config filter
func (*ConfigFilterConfigImpl) SetEnable ¶ added in v1.5.0
func (c *ConfigFilterConfigImpl) SetEnable(enable bool)
SetEnable set enable config filter
func (*ConfigFilterConfigImpl) SetPluginConfig ¶ added in v1.5.0
func (c *ConfigFilterConfigImpl) SetPluginConfig(pluginName string, value BaseConfig) error
SetPluginConfig set config filter plugin
func (*ConfigFilterConfigImpl) Verify ¶ added in v1.5.0
func (c *ConfigFilterConfigImpl) Verify() error
Verify verify config filter
type Configuration ¶
type Configuration interface { BaseConfig // GetGlobal global前缀开头的所有配置项 GetGlobal() GlobalConfig // GetConsumer consumer前缀开头的所有配置项 GetConsumer() ConsumerConfig // GetProvider provider前缀开头的所有配置项 GetProvider() ProviderConfig // GetConfigFile config前缀开头的所有配置项 GetConfigFile() ConfigFileConfig }
Configuration 全量配置对象.
type ConfigurationImpl ¶
type ConfigurationImpl struct { Global *GlobalConfigImpl `yaml:"global" json:"global"` Consumer *ConsumerConfigImpl `yaml:"consumer" json:"consumer"` Provider *ProviderConfigImpl `yaml:"provider" json:"provider"` Config *ConfigFileConfigImpl `yaml:"config" json:"config"` }
ConfigurationImpl cl5全局配置.
func LoadConfiguration ¶
func LoadConfiguration(buf []byte) (*ConfigurationImpl, error)
LoadConfiguration 加载配置项.
func LoadConfigurationByDefaultFile ¶
func LoadConfigurationByDefaultFile() (*ConfigurationImpl, error)
LoadConfigurationByDefaultFile 通过默认配置文件加载配置项.
func LoadConfigurationByFile ¶
func LoadConfigurationByFile(path string) (*ConfigurationImpl, error)
LoadConfigurationByFile 通过文件加载配置项.
func NewDefaultConfiguration ¶
func NewDefaultConfiguration(addresses []string) *ConfigurationImpl
NewDefaultConfiguration 创建默认配置对象.
func NewDefaultConfigurationWithDomain ¶
func NewDefaultConfigurationWithDomain() *ConfigurationImpl
NewDefaultConfigurationWithDomain 创建带有默认埋点server域名的默认配置.
func (*ConfigurationImpl) GetConfigFile ¶ added in v1.1.0
func (c *ConfigurationImpl) GetConfigFile() ConfigFileConfig
GetConfigFile config前缀开头的所有配置项.
func (*ConfigurationImpl) GetConsumer ¶
func (c *ConfigurationImpl) GetConsumer() ConsumerConfig
GetConsumer cl5.consumer前缀开头的所有配置项.
func (*ConfigurationImpl) GetGlobal ¶
func (c *ConfigurationImpl) GetGlobal() GlobalConfig
GetGlobal cl5.global前缀开头的所有配置项.
func (*ConfigurationImpl) GetProvider ¶
func (c *ConfigurationImpl) GetProvider() ProviderConfig
GetProvider consumer前缀开头的所有配置项.
func (*ConfigurationImpl) SetDefault ¶
func (c *ConfigurationImpl) SetDefault()
SetDefault 设置consumerConfig配置的默认值.
func (*ConfigurationImpl) Verify ¶
func (c *ConfigurationImpl) Verify() error
Verify 检验configuration配置.
type ConsumerConfig ¶
type ConsumerConfig interface { BaseConfig // GetLocalCache get local cache config GetLocalCache() LocalCacheConfig // GetServiceRouter get service router config GetServiceRouter() ServiceRouterConfig // GetLoadbalancer get load balancer config GetLoadbalancer() LoadbalancerConfig // GetCircuitBreaker get circuit breaker config GetCircuitBreaker() CircuitBreakerConfig // GetHealthCheck get health check config GetHealthCheck() HealthCheckConfig // GetServiceSpecific 服务独立配置 GetServiceSpecific(namespace string, service string) ServiceSpecificConfig }
ConsumerConfig consumer config object.
type ConsumerConfigImpl ¶
type ConsumerConfigImpl struct { LocalCache *LocalCacheConfigImpl `yaml:"localCache" json:"localCache"` ServiceRouter *ServiceRouterConfigImpl `yaml:"serviceRouter" json:"serviceRouter"` Loadbalancer *LoadBalancerConfigImpl `yaml:"loadbalancer" json:"loadbalancer"` CircuitBreaker *CircuitBreakerConfigImpl `yaml:"circuitBreaker" json:"circuitBreaker"` HealthCheck *HealthCheckConfigImpl `yaml:"healthCheck" json:"healthCheck"` ServicesSpecific []*ServiceSpecific `yaml:"servicesSpecific" json:"servicesSpecific"` }
ConsumerConfigImpl 消费者配置.
func (*ConsumerConfigImpl) GetCircuitBreaker ¶
func (c *ConsumerConfigImpl) GetCircuitBreaker() CircuitBreakerConfig
GetCircuitBreaker consumer.circuitbreaker前缀开头的所有配置.
func (*ConsumerConfigImpl) GetHealthCheck ¶
func (c *ConsumerConfigImpl) GetHealthCheck() HealthCheckConfig
GetHealthCheck get health check config.
func (*ConsumerConfigImpl) GetLoadbalancer ¶
func (c *ConsumerConfigImpl) GetLoadbalancer() LoadbalancerConfig
GetLoadbalancer consumer.loadbalancer前缀开头的所有配置.
func (*ConsumerConfigImpl) GetLocalCache ¶
func (c *ConsumerConfigImpl) GetLocalCache() LocalCacheConfig
GetLocalCache consumer.localCache前缀开头的所有配置.
func (*ConsumerConfigImpl) GetServiceRouter ¶
func (c *ConsumerConfigImpl) GetServiceRouter() ServiceRouterConfig
GetServiceRouter consumer.serviceRouter前缀开头的所有配置.
func (*ConsumerConfigImpl) GetServiceSpecific ¶
func (c *ConsumerConfigImpl) GetServiceSpecific(namespace string, service string) ServiceSpecificConfig
GetServiceSpecific 服务独立配置.
func (*ConsumerConfigImpl) SetDefault ¶
func (c *ConsumerConfigImpl) SetDefault()
SetDefault 设置consumerConfig配置的默认值.
func (*ConsumerConfigImpl) Verify ¶
func (c *ConsumerConfigImpl) Verify() error
Verify 检验consumerConfig配置.
type ErrorCountConfig ¶
type ErrorCountConfig interface { // GetContinuousErrorThreshold 连续错误数阈值 GetContinuousErrorThreshold() int // SetContinuousErrorThreshold 设置连续错误数阈值 SetContinuousErrorThreshold(int) // GetMetricStatTimeWindow 连续错误数统计时间窗口 GetMetricStatTimeWindow() time.Duration // SetMetricStatTimeWindow 设置连续错误数统计时间窗口 SetMetricStatTimeWindow(time.Duration) // GetMetricNumBuckets 连续错误数统计滑桶数量 GetMetricNumBuckets() int // SetMetricNumBuckets 设置连续错误数统计滑桶数量 SetMetricNumBuckets(int) // GetBucketInterval 获取单个滑桶的时间间隔 GetBucketInterval() time.Duration }
ErrorCountConfig 连续错误数熔断配置.
type ErrorRateConfig ¶
type ErrorRateConfig interface { // GetRequestVolumeThreshold 触发错误率熔断的请求量阈值 GetRequestVolumeThreshold() int // SetRequestVolumeThreshold 设置触发错误率熔断的请求量阈值 SetRequestVolumeThreshold(int) // GetErrorRatePercent 触发熔断的错误率阈值,取值范围(0, 100] GetErrorRatePercent() int // SetErrorRatePercent 设置错误率阈值 SetErrorRatePercent(int) // GetMetricStatTimeWindow 错误率统计时间窗口 GetMetricStatTimeWindow() time.Duration // SetMetricStatTimeWindow 设置错误率统计时间窗口 SetMetricStatTimeWindow(time.Duration) // GetMetricNumBuckets 统计窗口细分的桶数量 GetMetricNumBuckets() int // SetMetricNumBuckets 设置统计窗口细分的桶数量 SetMetricNumBuckets(int) // GetBucketInterval 获取单个滑桶的时间间隔 GetBucketInterval() time.Duration }
ErrorRateConfig 错误率熔断配置.
type GlobalConfig ¶
type GlobalConfig interface { BaseConfig // GetSystem . GetSystem() SystemConfig // GetAPI global.api前缀开头的所有配置项 GetAPI() APIConfig // GetServerConnector global.serverConnector前缀开头的所有配置项 GetServerConnector() ServerConnectorConfig // GetStatReporter global.statReporter前缀开头的所有配置项 GetStatReporter() StatReporterConfig // GetLocation global.location前缀开头的所有配置项 GetLocation() LocationConfig }
GlobalConfig 全局配置对象.
type GlobalConfigImpl ¶
type GlobalConfigImpl struct { System *SystemConfigImpl `yaml:"system" json:"system"` API *APIConfigImpl `yaml:"api" json:"api"` ServerConnector *ServerConnectorConfigImpl `yaml:"serverConnector" json:"serverConnector"` StatReporter *StatReporterConfigImpl `yaml:"statReporter" json:"statReporter"` Location *LocationConfigImpl `yaml:"location" json:"location"` }
GlobalConfigImpl 全局配置.
func (*GlobalConfigImpl) GetAPI ¶
func (g *GlobalConfigImpl) GetAPI() APIConfig
GetAPI global.api前缀开头的所有配置项.
func (*GlobalConfigImpl) GetLocation ¶ added in v1.1.0
func (g *GlobalConfigImpl) GetLocation() LocationConfig
GetLocation cl5.global.location前缀开头的所有配置项.
func (*GlobalConfigImpl) GetServerConnector ¶
func (g *GlobalConfigImpl) GetServerConnector() ServerConnectorConfig
GetServerConnector global.serverConnector前缀开头的所有配置项.
func (*GlobalConfigImpl) GetStatReporter ¶
func (g *GlobalConfigImpl) GetStatReporter() StatReporterConfig
GetStatReporter cl5.global.statReporter前缀开头的所有配置项.
func (*GlobalConfigImpl) GetSystem ¶
func (g *GlobalConfigImpl) GetSystem() SystemConfig
GetSystem 获取系统配置.
func (*GlobalConfigImpl) SetDefault ¶
func (g *GlobalConfigImpl) SetDefault()
SetDefault 设置globalConfig配置的默认值.
func (*GlobalConfigImpl) Verify ¶
func (g *GlobalConfigImpl) Verify() error
Verify 检验globalConfig配置.
type HealthCheckConfig ¶
type HealthCheckConfig interface { BaseConfig PluginConfig // GetWhen get when to active health check GetWhen() When // SetWhen set when to active health check SetWhen(When) // GetInterval get health check interval GetInterval() time.Duration // SetInterval set health check interval SetInterval(duration time.Duration) // GetTimeout get health check max timeout GetTimeout() time.Duration // SetTimeout set health check max timeout SetTimeout(duration time.Duration) // GetConcurrency get concurrency to execute the health check jobs GetConcurrency() int // SetConcurrency set concurrency to execute the health check jobs SetConcurrency(int) // GetChain get health checking chain GetChain() []string // SetChain set health checking chain SetChain([]string) }
HealthCheckConfig active health check config.
type HealthCheckConfigImpl ¶
type HealthCheckConfigImpl struct { When When `yaml:"when" json:"when"` Interval time.Duration `yaml:"interval" json:"interval"` Timeout time.Duration `yaml:"timeout" json:"timeout"` Chain []string `yaml:"chain" json:"chain"` Concurrency int `yaml:"concurrency" json:"concurrency"` Plugin PluginConfigs `yaml:"plugin" json:"plugin"` }
HealthCheckConfigImpl health check config implementation.
func (*HealthCheckConfigImpl) GetChain ¶
func (h *HealthCheckConfigImpl) GetChain() []string
GetChain get health checking chain.
func (*HealthCheckConfigImpl) GetConcurrency ¶
func (h *HealthCheckConfigImpl) GetConcurrency() int
GetConcurrency get concurrency to execute the health check jobs.
func (*HealthCheckConfigImpl) GetInterval ¶
func (h *HealthCheckConfigImpl) GetInterval() time.Duration
GetInterval get health check interval.
func (*HealthCheckConfigImpl) GetPluginConfig ¶
func (h *HealthCheckConfigImpl) GetPluginConfig(pluginName string) BaseConfig
GetPluginConfig get plugin config by name.
func (*HealthCheckConfigImpl) GetTimeout ¶
func (h *HealthCheckConfigImpl) GetTimeout() time.Duration
GetTimeout get health check max timeout.
func (*HealthCheckConfigImpl) GetWhen ¶
func (h *HealthCheckConfigImpl) GetWhen() When
GetWhen get when to active health check.
func (*HealthCheckConfigImpl) Init ¶
func (h *HealthCheckConfigImpl) Init()
Init 初始化CircuitBreakerConfigImpl配置.
func (*HealthCheckConfigImpl) SetChain ¶
func (h *HealthCheckConfigImpl) SetChain(chain []string)
SetChain set health checking chain.
func (*HealthCheckConfigImpl) SetConcurrency ¶
func (h *HealthCheckConfigImpl) SetConcurrency(value int)
SetConcurrency set concurrency to execute the health check jobs.
func (*HealthCheckConfigImpl) SetDefault ¶
func (h *HealthCheckConfigImpl) SetDefault()
SetDefault set default values to healthCheckConfig.
func (*HealthCheckConfigImpl) SetInterval ¶
func (h *HealthCheckConfigImpl) SetInterval(duration time.Duration)
SetInterval set health check interval.
func (*HealthCheckConfigImpl) SetPluginConfig ¶
func (h *HealthCheckConfigImpl) SetPluginConfig(pluginName string, value BaseConfig) error
SetPluginConfig set plugin config by name.
func (*HealthCheckConfigImpl) SetTimeout ¶
func (h *HealthCheckConfigImpl) SetTimeout(duration time.Duration)
SetTimeout set health check max timeout.
func (*HealthCheckConfigImpl) SetWhen ¶
func (h *HealthCheckConfigImpl) SetWhen(when When)
SetWhen set when to active health check.
func (*HealthCheckConfigImpl) Verify ¶
func (h *HealthCheckConfigImpl) Verify() error
Verify the healthCheckConfig.
type LoadBalancerConfigImpl ¶
type LoadBalancerConfigImpl struct { // 负载均衡类型 Type string `yaml:"type" json:"type"` // 插件相关配置 Plugin PluginConfigs `yaml:"plugin" json:"plugin"` }
LoadBalancerConfigImpl 负载均衡配置.
func (*LoadBalancerConfigImpl) GetPluginConfig ¶
func (l *LoadBalancerConfigImpl) GetPluginConfig(pluginName string) BaseConfig
GetPluginConfig consumer.loadbalancer.plugin.
func (*LoadBalancerConfigImpl) GetType ¶
func (l *LoadBalancerConfigImpl) GetType() string
GetType 负载均衡类型.
func (*LoadBalancerConfigImpl) SetDefault ¶
func (l *LoadBalancerConfigImpl) SetDefault()
SetDefault 设置LocalCacheConfig配置的默认值.
func (*LoadBalancerConfigImpl) SetPluginConfig ¶
func (l *LoadBalancerConfigImpl) SetPluginConfig(pluginName string, value BaseConfig) error
SetPluginConfig 输出插件具体配置.
func (*LoadBalancerConfigImpl) SetType ¶
func (l *LoadBalancerConfigImpl) SetType(typ string)
SetType 设置负载均衡类型.
func (*LoadBalancerConfigImpl) Verify ¶
func (l *LoadBalancerConfigImpl) Verify() error
Verify 检验LocalCacheConfig配置.
type LoadbalancerConfig ¶
type LoadbalancerConfig interface { BaseConfig PluginConfig // GetType 负载均衡类型 GetType() string // SetType 设置负载均衡类型 SetType(string) }
LoadbalancerConfig 负载均衡相关配置项.
type LocalCacheConfig ¶
type LocalCacheConfig interface { BaseConfig PluginConfig // GetServiceExpireTime consumer.localCache.service.expireTime, // 服务的超时淘汰时间 GetServiceExpireTime() time.Duration // SetServiceExpireTime 设置服务的超时淘汰时间 SetServiceExpireTime(time.Duration) // GetServiceRefreshInterval consumer.localCache.service.refreshInterval // 服务的定期刷新时间 GetServiceRefreshInterval() time.Duration // SetServiceRefreshInterval 设置服务的定期刷新时间 SetServiceRefreshInterval(time.Duration) // IsPersistEnable consumer.localCache.persistEnable // 是否启用本地缓存 IsPersistEnable() bool // SetPersistEnable 设置是否启用本地缓存 SetPersistEnable(enable bool) // GetPersistDir consumer.localCache.persistDir // 本地缓存持久化路径 GetPersistDir() string // SetPersistDir 设置本地缓存持久化路径 SetPersistDir(string) // GetType consumer.localCache.type // 本地缓存类型,默认default,可修改成具体的缓存插件名 GetType() string // SetType 设置本地缓存类型 SetType(string) // GetPersistMaxWriteRetry consumer.localCache.persistMaxWriteRetry // 缓存最大写重试次数 GetPersistMaxWriteRetry() int // SetPersistMaxWriteRetry 设置缓存最大写重试次数 SetPersistMaxWriteRetry(int) // GetPersistMaxReadRetry consumer.localCache.persistMaxReadRetry // 缓存最大读重试次数 GetPersistMaxReadRetry() int // SetPersistMaxReadRetry 设置缓存最大读重试次数 SetPersistMaxReadRetry(int) // GetPersistRetryInterval consumer.localCache.persistRetryInterval // 缓存持久化重试间隔 GetPersistRetryInterval() time.Duration // SetPersistRetryInterval 设置缓存持久化重试间隔 SetPersistRetryInterval(time.Duration) // GetPersistAvailableInterval 获取缓存文件有效时间 GetPersistAvailableInterval() time.Duration // SetPersistAvailableInterval 设置缓存文件有效时间 SetPersistAvailableInterval(interval time.Duration) // GetStartUseFileCache 获取是否可以直接使用缓存标签 GetStartUseFileCache() bool // SetStartUseFileCache 设置是否可以直接使用缓存 SetStartUseFileCache(useCacheFile bool) // SetPushEmptyProtection 设置推空保护开关 SetPushEmptyProtection(pushEmptyProtection bool) // GetPushEmptyProtection 获取推空保护开关 GetPushEmptyProtection() bool }
LocalCacheConfig 本地缓存相关配置项.
type LocalCacheConfigImpl ¶
type LocalCacheConfigImpl struct { // consumer.localCache.service.expireTime, // 服务的超时淘汰时间 ServiceExpireTime *time.Duration `yaml:"serviceExpireTime" json:"serviceExpireTime"` // consumer.localCache.service.refreshInterval // 服务的定期刷新时间 ServiceRefreshInterval *time.Duration `yaml:"serviceRefreshInterval" json:"serviceRefreshInterval"` // consumer.localCache.persistDir // 本地缓存持久化路径 PersistDir string `yaml:"persistDir" json:"persistDir"` // consumer.localCache.type // 本地缓存类型,默认inmemory,可修改成具体的缓存插件名 Type string `yaml:"type" json:"type"` // 是否启用本地缓存 PersistEnable bool `yaml:"persistEnable" json:"persistEnable"` // consumer.localCache.persistMaxWriteRetry PersistMaxWriteRetry int `yaml:"persistMaxWriteRetry" json:"persistMaxWriteRetry"` // consumer.localCache.persistReadRetry PersistMaxReadRetry int `yaml:"persistMaxReadRetry" json:"persistMaxReadRetry"` // consumer.localCache.persistRetryInterval PersistRetryInterval *time.Duration `yaml:"persistRetryInterval" json:"persistRetryInterval"` // 缓存文件有效时间差值 PersistAvailableInterval *time.Duration `yaml:"persistAvailableInterval" json:"persistAvailableInterval"` // 启动后,首次名字服务是否可以使用缓存文件 StartUseFileCache *bool `yaml:"startUseFileCache" json:"startUseFileCache"` // PushEmptyProtection 推空保护开关 PushEmptyProtection *bool `yaml:"pushEmptyProtection" json:"pushEmptyProtection"` // 插件相关配置 Plugin PluginConfigs `yaml:"plugin" json:"plugin"` }
LocalCacheConfigImpl 本地缓存配置.
func (*LocalCacheConfigImpl) GetPersistAvailableInterval ¶
func (l *LocalCacheConfigImpl) GetPersistAvailableInterval() time.Duration
GetPersistAvailableInterval consumer.localCache.persist.availableInterval.
func (*LocalCacheConfigImpl) GetPersistDir ¶
func (l *LocalCacheConfigImpl) GetPersistDir() string
GetPersistDir consumer.localCache.persist.path 本地缓存持久化路径.
func (*LocalCacheConfigImpl) GetPersistMaxReadRetry ¶
func (l *LocalCacheConfigImpl) GetPersistMaxReadRetry() int
GetPersistMaxReadRetry consumer.localCache.persist.maxReadRetry.
func (*LocalCacheConfigImpl) GetPersistMaxWriteRetry ¶
func (l *LocalCacheConfigImpl) GetPersistMaxWriteRetry() int
GetPersistMaxWriteRetry consumer.localCache.persist.maxWriteRetry.
func (*LocalCacheConfigImpl) GetPersistRetryInterval ¶
func (l *LocalCacheConfigImpl) GetPersistRetryInterval() time.Duration
GetPersistRetryInterval consumer.localCache.persist.retryInterval.
func (*LocalCacheConfigImpl) GetPluginConfig ¶
func (l *LocalCacheConfigImpl) GetPluginConfig(pluginName string) BaseConfig
GetPluginConfig consumer.localCache.plugin.
func (*LocalCacheConfigImpl) GetPushEmptyProtection ¶ added in v1.2.0
func (l *LocalCacheConfigImpl) GetPushEmptyProtection() bool
GetPushEmptyProtection 获取推空保护开关
func (*LocalCacheConfigImpl) GetServiceExpireTime ¶
func (l *LocalCacheConfigImpl) GetServiceExpireTime() time.Duration
GetServiceExpireTime consumer.localCache.service.expireTime, 服务的超时淘汰时间.
func (*LocalCacheConfigImpl) GetServiceRefreshInterval ¶
func (l *LocalCacheConfigImpl) GetServiceRefreshInterval() time.Duration
GetServiceRefreshInterval consumer.localCache.service.refreshInterval 服务的定期刷新间隔.
func (*LocalCacheConfigImpl) GetStartUseFileCache ¶
func (l *LocalCacheConfigImpl) GetStartUseFileCache() bool
GetStartUseFileCache 获取是否可以直接使用缓存标签.
func (*LocalCacheConfigImpl) GetType ¶
func (l *LocalCacheConfigImpl) GetType() string
GetType consumer.localCache.type 本地缓存类型,默认default,可修改成具体的缓存插件名.
func (*LocalCacheConfigImpl) IsPersistEnable ¶ added in v1.2.0
func (l *LocalCacheConfigImpl) IsPersistEnable() bool
IsPersistEnable consumer.localCache.persistEnable 是否启用本地缓存
func (*LocalCacheConfigImpl) SetDefault ¶
func (l *LocalCacheConfigImpl) SetDefault()
SetDefault 设置LocalCacheConfig配置的默认值.
func (*LocalCacheConfigImpl) SetPersistAvailableInterval ¶
func (l *LocalCacheConfigImpl) SetPersistAvailableInterval(interval time.Duration)
SetPersistAvailableInterval 设置本地缓存持久化文件有效时间差值.
func (*LocalCacheConfigImpl) SetPersistDir ¶
func (l *LocalCacheConfigImpl) SetPersistDir(dir string)
SetPersistDir 设置本地缓存持久化路径.
func (*LocalCacheConfigImpl) SetPersistEnable ¶ added in v1.2.0
func (l *LocalCacheConfigImpl) SetPersistEnable(enable bool)
SetPersistEnable 设置是否启用本地缓存
func (*LocalCacheConfigImpl) SetPersistMaxReadRetry ¶
func (l *LocalCacheConfigImpl) SetPersistMaxReadRetry(maxReadRetry int)
SetPersistMaxReadRetry 设置本地缓存持久化读取失败重试次数.
func (*LocalCacheConfigImpl) SetPersistMaxWriteRetry ¶
func (l *LocalCacheConfigImpl) SetPersistMaxWriteRetry(maxWriteRetry int)
SetPersistMaxWriteRetry 设置本地缓存持久化写入失败重试次数.
func (*LocalCacheConfigImpl) SetPersistRetryInterval ¶
func (l *LocalCacheConfigImpl) SetPersistRetryInterval(interval time.Duration)
SetPersistRetryInterval 设置本地缓存持久化重试间隔.
func (*LocalCacheConfigImpl) SetPluginConfig ¶
func (l *LocalCacheConfigImpl) SetPluginConfig(pluginName string, value BaseConfig) error
SetPluginConfig 输出插件具体配置.
func (*LocalCacheConfigImpl) SetPushEmptyProtection ¶ added in v1.2.0
func (l *LocalCacheConfigImpl) SetPushEmptyProtection(pushEmptyProtection bool)
SetPushEmptyProtection 设置推空保护开关
func (*LocalCacheConfigImpl) SetServiceExpireTime ¶
func (l *LocalCacheConfigImpl) SetServiceExpireTime(expireTime time.Duration)
SetServiceExpireTime 设置服务超时淘汰时间.
func (*LocalCacheConfigImpl) SetServiceRefreshInterval ¶
func (l *LocalCacheConfigImpl) SetServiceRefreshInterval(interval time.Duration)
SetServiceRefreshInterval 设置服务定时刷新间隔.
func (*LocalCacheConfigImpl) SetStartUseFileCache ¶
func (l *LocalCacheConfigImpl) SetStartUseFileCache(useCacheFile bool)
SetStartUseFileCache 设置是否可以直接使用缓存.
func (*LocalCacheConfigImpl) SetType ¶
func (l *LocalCacheConfigImpl) SetType(typ string)
SetType 设置本地缓存类型.
func (*LocalCacheConfigImpl) Verify ¶
func (l *LocalCacheConfigImpl) Verify() error
Verify 检验LocalCacheConfig配置.
type LocationConfig ¶ added in v1.1.0
type LocationConfig interface { BaseConfig // GetProvider 获取地理位置的提供者插件名称 GetProviders() []*LocationProviderConfigImpl GetProvider(typ string) *LocationProviderConfigImpl }
LocationConfig SDK获取自身当前地理位置配置.
type LocationConfigImpl ¶ added in v1.1.0
type LocationConfigImpl struct {
Providers []*LocationProviderConfigImpl `yaml:"providers" json:"providers"`
}
LocationConfigImpl 地理位置配置.
func (*LocationConfigImpl) GetProvider ¶ added in v1.1.0
func (a *LocationConfigImpl) GetProvider(providerType string) *LocationProviderConfigImpl
GetProvider 根据类型获取对应的provider
func (*LocationConfigImpl) GetProviders ¶ added in v1.4.0
func (a *LocationConfigImpl) GetProviders() []*LocationProviderConfigImpl
GetProviders 获取所有的provider
func (*LocationConfigImpl) SetDefault ¶ added in v1.1.0
func (a *LocationConfigImpl) SetDefault()
SetDefault 设置LocalCacheConfig配置的默认值.
func (*LocationConfigImpl) Verify ¶ added in v1.1.0
func (a *LocationConfigImpl) Verify() error
Verify 检验LocalCacheConfig配置.
type LocationProviderConfigImpl ¶ added in v1.4.0
type LocationProviderConfigImpl struct { Type string `yaml:"type" json:"type"` Options map[string]interface{} `yaml:"options" json:"options"` }
func (LocationProviderConfigImpl) GetOptions ¶ added in v1.4.0
func (l LocationProviderConfigImpl) GetOptions() map[string]interface{}
func (LocationProviderConfigImpl) GetType ¶ added in v1.4.0
func (l LocationProviderConfigImpl) GetType() string
func (LocationProviderConfigImpl) SetDefault ¶ added in v1.4.0
func (l LocationProviderConfigImpl) SetDefault()
func (LocationProviderConfigImpl) Verify ¶ added in v1.4.0
func (l LocationProviderConfigImpl) Verify() error
type NearbyConfig ¶
type NearbyConfig interface { BaseConfig // SetMatchLevel 设置匹配级别,consumer.serviceRouter.plugin.nearbyBasedRouter.matchLevel SetMatchLevel(level string) // GetMatchLevel 获取匹配级别,consumer.serviceRouter.plugin.nearbyBasedRouter.matchLevel GetMatchLevel() string // SetLowestMatchLevel . // Deprecated: 设置可以降级的最低匹配级别, 已废弃,请使用SetMaxMatchLevel SetLowestMatchLevel(level string) // GetLowestMatchLevel . // Deprecated: 获取可以降级的最低匹配级别,已废弃,请使用GetMaxMatchLevel GetLowestMatchLevel() string // SetMaxMatchLevel 设置可以降级的最低匹配级别,consumer.serviceRouter.plugin.nearbyBasedRouter.maxMatchLevel SetMaxMatchLevel(level string) // GetMaxMatchLevel 获取可以降级的最低匹配级别,consumer.serviceRouter.plugin.nearbyBasedRouter.maxMatchLevel GetMaxMatchLevel() string // SetStrictNearby 设置是否进行严格就近,consumer.serviceRouter.plugin.nearbyBasedRouter.strictNearby SetStrictNearby(s bool) // IsStrictNearby 获取是否进行严格就近,consumer.serviceRouter.plugin.nearbyBasedRouter.strictNearby IsStrictNearby() bool // IsEnableDegradeByUnhealthyPercent 是否开启根据不健康实例比例进行降级就近匹配, // consumer.serviceRouter.plugin.nearbyBasedRouter.enableDegradeByUnhealthyPercent IsEnableDegradeByUnhealthyPercent() bool // SetEnableDegradeByUnhealthyPercent 设置是否开启根据不健康实例比例进行降级就近匹配 // consumer.serviceRouter.plugin.nearbyBasedRouter.enableDegradeByUnhealthyPercent SetEnableDegradeByUnhealthyPercent(e bool) // GetUnhealthyPercentToDegrade 获取触发降级匹配的不健康实例比例, // consumer.serviceRouter.plugin.nearbyBasedRouter.unhealthyPercentToDegrade GetUnhealthyPercentToDegrade() int // SetUnhealthyPercentToDegrade 设置触发降级匹配的不健康实例比例,consumer.serviceRouter.plugin.nearbyBasedRouter.unhealthyPercentToDegrade SetUnhealthyPercentToDegrade(u int) }
NearbyConfig 就近路由配置.
type PluginConfig ¶
type PluginConfig interface { // GetPluginConfig 获取plugin.<name>下的插件配置,将map[string]interface形式的配置marshal进value中 GetPluginConfig(pluginName string) BaseConfig // SetPluginConfig 设置插件配置,将value的内容unmarshal为map[string]interface{}形式 SetPluginConfig(plugName string, value BaseConfig) error }
PluginConfig 插件配置对象.
type PluginConfigs ¶
type PluginConfigs map[string]interface{}
PluginConfigs 插件配置实现类.
func (PluginConfigs) GetPluginConfig ¶
func (p PluginConfigs) GetPluginConfig(pluginName string) BaseConfig
GetPluginConfig 根据插件名获取配置.
func (PluginConfigs) SetDefault ¶
func (p PluginConfigs) SetDefault(typ common.Type)
SetDefault 设置默认值.
func (PluginConfigs) SetPluginConfig ¶
func (p PluginConfigs) SetPluginConfig(plugType common.Type, plugName string, value BaseConfig) error
SetPluginConfig 设置单独一个插件的值.
type ProviderConfig ¶
type ProviderConfig interface { BaseConfig // GetRateLimit 获取限流配置 GetRateLimit() RateLimitConfig // GetMinRegisterInterval get minimum interval between two register operation GetMinRegisterInterval() time.Duration }
ProviderConfig 被调端配置对象.
type ProviderConfigImpl ¶
type ProviderConfigImpl struct { // 限流配置 RateLimit *RateLimitConfigImpl `yaml:"rateLimit" json:"rateLimit"` // minimum interval between tow register operation MinRgisterInterval time.Duration `yaml:"minRegisterInterval" json:"minRegisterInterval"` }
ProviderConfigImpl 服务提供者配置.
func (*ProviderConfigImpl) GetMinRegisterInterval ¶ added in v1.2.0
func (p *ProviderConfigImpl) GetMinRegisterInterval() time.Duration
GetMinRegisterInterval get minimum interval between two register operation
func (*ProviderConfigImpl) GetRateLimit ¶
func (p *ProviderConfigImpl) GetRateLimit() RateLimitConfig
GetRateLimit 是否启用限流能力.
func (*ProviderConfigImpl) SetDefault ¶
func (p *ProviderConfigImpl) SetDefault()
SetDefault 设置默认参数.
type RateLimitConfig ¶
type RateLimitConfig interface { BaseConfig PluginConfig // IsEnable 是否启用限流能力 IsEnable() bool // SetEnable 设置是否启用限流能力 SetEnable(bool) // GetMaxWindowSize 获取最大限流窗口数量 GetMaxWindowSize() int // SetMaxWindowSize 设置最大限流窗口数量 SetMaxWindowSize(maxSize int) // GetPurgeInterval 获取超时淘汰周期 GetPurgeInterval() time.Duration // SetPurgeInterval 设置超时淘汰周期 SetPurgeInterval(time.Duration) // GetLimiterService 获取限流服务 GetLimiterService() string // SetLimiterService 设置限流服务 SetLimiterService(value string) // SetLimiterNamespace 设置限流命名空间 SetLimiterNamespace(value string) // GetLimiterNamespace 获取限流命名空间 GetLimiterNamespace() string }
RateLimitConfig 限流相关配置.
type RateLimitConfigImpl ¶
type RateLimitConfigImpl struct { // 是否启动限流 Enable *bool `yaml:"enable" json:"enable"` // 各个限流插件的配置 Plugin PluginConfigs `yaml:"plugin" json:"plugin"` // 最大限流窗口数量 MaxWindowSize int `yaml:"maxWindowSize" json:"maxWindowSize"` // 超时window检查周期 PurgeInterval time.Duration `yaml:"purgeInterval" json:"purgeInterval"` // LimiterNamespace 限流服务的命名空间 LimiterNamespace string `yaml:"limiterNamespace" json:"limiterNamespace"` // LimiterService 限流服务的服务名 LimiterService string `yaml:"limiterService" json:"limiterService"` }
RateLimitConfigImpl 限流配置对象.
func (*RateLimitConfigImpl) GetLimiterNamespace ¶ added in v1.2.0
func (r *RateLimitConfigImpl) GetLimiterNamespace() string
func (*RateLimitConfigImpl) GetLimiterService ¶ added in v1.2.0
func (r *RateLimitConfigImpl) GetLimiterService() string
func (*RateLimitConfigImpl) GetMaxWindowSize ¶
func (r *RateLimitConfigImpl) GetMaxWindowSize() int
GetMaxWindowSize .
func (*RateLimitConfigImpl) GetPluginConfig ¶
func (r *RateLimitConfigImpl) GetPluginConfig(pluginName string) BaseConfig
GetPluginConfig 获取插件配置.
func (*RateLimitConfigImpl) GetPurgeInterval ¶
func (r *RateLimitConfigImpl) GetPurgeInterval() time.Duration
GetPurgeInterval .
func (*RateLimitConfigImpl) IsEnable ¶
func (r *RateLimitConfigImpl) IsEnable() bool
IsEnable 是否启用限流能力.
func (*RateLimitConfigImpl) SetDefault ¶
func (r *RateLimitConfigImpl) SetDefault()
SetDefault 设置默认参数.
func (*RateLimitConfigImpl) SetEnable ¶
func (r *RateLimitConfigImpl) SetEnable(value bool)
SetEnable 设置是否启用限流能力.
func (*RateLimitConfigImpl) SetLimiterNamespace ¶ added in v1.2.0
func (r *RateLimitConfigImpl) SetLimiterNamespace(value string)
func (*RateLimitConfigImpl) SetLimiterService ¶ added in v1.2.0
func (r *RateLimitConfigImpl) SetLimiterService(value string)
func (*RateLimitConfigImpl) SetMaxWindowSize ¶
func (r *RateLimitConfigImpl) SetMaxWindowSize(maxSize int)
SetMaxWindowSize .
func (*RateLimitConfigImpl) SetPluginConfig ¶
func (r *RateLimitConfigImpl) SetPluginConfig(pluginName string, value BaseConfig) error
SetPluginConfig 设置插件配置.
func (*RateLimitConfigImpl) SetPurgeInterval ¶
func (r *RateLimitConfigImpl) SetPurgeInterval(v time.Duration)
SetPurgeInterval .
type ServerClusterConfig ¶
type ServerClusterConfig interface { BaseConfig // GetNamespace 获取命名空间 GetNamespace() string // SetNamespace 设置命名空间 SetNamespace(string) // GetService 获取服务名 GetService() string // SetService 设置服务名 SetService(string) // GetRefreshInterval 系统服务的刷新间隔 GetRefreshInterval() time.Duration // SetRefreshInterval 设置系统服务的刷新间隔 SetRefreshInterval(time.Duration) }
ServerClusterConfig 单个系统服务集群.
type ServerClusterConfigImpl ¶
type ServerClusterConfigImpl struct { Namespace string `yaml:"namespace" json:"namespace"` Service string `yaml:"service" json:"service"` RefreshInterval *time.Duration `yaml:"refreshInterval" json:"refreshInterval"` }
ServerClusterConfigImpl 单个服务集群配置.
func NewServerClusterConfig ¶
func NewServerClusterConfig(svcKey model.ServiceKey) *ServerClusterConfigImpl
NewServerClusterConfig 通过服务信息创建服务集群配置.
func (*ServerClusterConfigImpl) GetNamespace ¶
func (s *ServerClusterConfigImpl) GetNamespace() string
GetNamespace 获取命名空间.
func (*ServerClusterConfigImpl) GetRefreshInterval ¶
func (s *ServerClusterConfigImpl) GetRefreshInterval() time.Duration
GetRefreshInterval 获取系统服务刷新间隔.
func (*ServerClusterConfigImpl) GetService ¶
func (s *ServerClusterConfigImpl) GetService() string
GetService 获取服务名.
func (*ServerClusterConfigImpl) SetDefault ¶
func (s *ServerClusterConfigImpl) SetDefault()
SetDefault 设置ServerClusterConfig默认配置.
func (*ServerClusterConfigImpl) SetNamespace ¶
func (s *ServerClusterConfigImpl) SetNamespace(namespace string)
SetNamespace 设置命名空间.
func (*ServerClusterConfigImpl) SetRefreshInterval ¶
func (s *ServerClusterConfigImpl) SetRefreshInterval(interval time.Duration)
SetRefreshInterval 获取系统服务刷新间隔.
func (*ServerClusterConfigImpl) SetService ¶
func (s *ServerClusterConfigImpl) SetService(service string)
SetService 设置服务名.
func (*ServerClusterConfigImpl) Verify ¶
func (s *ServerClusterConfigImpl) Verify() error
Verify 校验ServerClusterConfig配置.
type ServerConnectorConfig ¶
type ServerConnectorConfig interface { BaseConfig PluginConfig // GetAddresses global.serverConnector.addresses // 远端server地址,格式为<host>:<port> GetAddresses() []string // SetAddresses 设置远端server地址,格式为<host>:<port> SetAddresses([]string) // GetProtocol global.serverConnector.protocol // 与server对接的协议 GetProtocol() string // SetProtocol 设置与server对接的协议 SetProtocol(string) // GetConnectTimeout global.serverConnector.connectTimeout // 与server的连接超时时间 GetConnectTimeout() time.Duration // SetConnectTimeout 设置与server的连接超时时间 SetConnectTimeout(time.Duration) // GetMessageTimeout global.registry.messageTimeout // 远程请求超时时间 GetMessageTimeout() time.Duration // SetMessageTimeout 设置远程请求超时时间 SetMessageTimeout(time.Duration) // GetRequestQueueSize global.serverConnector.clientRequestQueueSize // 新请求的队列BUFFER容量 GetRequestQueueSize() int32 // SetRequestQueueSize 设置新请求的队列BUFFER容量 SetRequestQueueSize(int32) // GetServerSwitchInterval global.serverConnector.serverSwitchInterval // server的切换时延 GetServerSwitchInterval() time.Duration // SetServerSwitchInterval 设置server的切换时延 SetServerSwitchInterval(time.Duration) // GetReconnectInterval 获取一次连接失败后,到下一次重连的间隔时间 GetReconnectInterval() time.Duration // SetReconnectInterval 设置重试连接的间隔时间 SetReconnectInterval(time.Duration) // GetConnectionIdleTimeout global.serverConnector.connectionIdleTimeout // 连接会被释放的空闲的时长 GetConnectionIdleTimeout() time.Duration // SetConnectionIdleTimeout 设置连接会被释放的空闲的时长 SetConnectionIdleTimeout(time.Duration) }
ServerConnectorConfig 与名字服务服务端的连接配置.
type ServerConnectorConfigImpl ¶
type ServerConnectorConfigImpl struct { Addresses []string `yaml:"addresses" json:"addresses"` Protocol string `yaml:"protocol" json:"protocol"` ConnectTimeout *time.Duration `yaml:"connectTimeout" json:"connectTimeout"` // 远程请求超时时间 MessageTimeout *time.Duration `yaml:"messageTimeout" json:"messageTimeout"` ConnectionIdleTimeout *time.Duration `yaml:"connectionIdleTimeout" json:"connectionIdleTimeout"` RequestQueueSize *int32 `yaml:"requestQueueSize" json:"requestQueueSize"` ServerSwitchInterval *time.Duration `yaml:"serverSwitchInterval" json:"serverSwitchInterval"` ReconnectInterval *time.Duration `yaml:"reconnectInterval" json:"reconnectInterval"` Plugin PluginConfigs `yaml:"plugin" json:"plugin"` }
ServerConnectorConfigImpl 对接注册中心相关配置.
func (*ServerConnectorConfigImpl) GetAddresses ¶
func (s *ServerConnectorConfigImpl) GetAddresses() []string
GetAddresses global.serverConnector.addresses 远端cl5 server地址,格式为<host>:<port>.
func (*ServerConnectorConfigImpl) GetConnectTimeout ¶
func (s *ServerConnectorConfigImpl) GetConnectTimeout() time.Duration
GetConnectTimeout global.serverConnector.connectTimeout 与server的连接超时时间.
func (*ServerConnectorConfigImpl) GetConnectionIdleTimeout ¶
func (s *ServerConnectorConfigImpl) GetConnectionIdleTimeout() time.Duration
GetConnectionIdleTimeout global.serverConnector.connectionIdleTimeout 连接空闲后超时时间.
func (*ServerConnectorConfigImpl) GetMessageTimeout ¶
func (s *ServerConnectorConfigImpl) GetMessageTimeout() time.Duration
GetMessageTimeout global.serverConnector.messageTimeout 远程请求超时时间.
func (*ServerConnectorConfigImpl) GetPluginConfig ¶
func (s *ServerConnectorConfigImpl) GetPluginConfig(pluginName string) BaseConfig
GetPluginConfig global.serverConnector.plugin.
func (*ServerConnectorConfigImpl) GetProtocol ¶
func (s *ServerConnectorConfigImpl) GetProtocol() string
GetProtocol global.serverConnector.protocol 与cl5 server对接的协议.
func (*ServerConnectorConfigImpl) GetReconnectInterval ¶
func (s *ServerConnectorConfigImpl) GetReconnectInterval() time.Duration
GetReconnectInterval 一次连接失败后,到下一次连接之间的最小间隔时间.
func (*ServerConnectorConfigImpl) GetRequestQueueSize ¶
func (s *ServerConnectorConfigImpl) GetRequestQueueSize() int32
GetRequestQueueSize global.serverConnector.requestQueueSize 新请求的队列BUFFER容量.
func (*ServerConnectorConfigImpl) GetServerSwitchInterval ¶
func (s *ServerConnectorConfigImpl) GetServerSwitchInterval() time.Duration
GetServerSwitchInterval global.serverConnector.serverSwitchInterval server的切换时延.
func (*ServerConnectorConfigImpl) SetAddresses ¶
func (s *ServerConnectorConfigImpl) SetAddresses(addresses []string)
SetAddresses 设置远端cl5 server地址,格式为<host>:<port>.
func (*ServerConnectorConfigImpl) SetConnectTimeout ¶
func (s *ServerConnectorConfigImpl) SetConnectTimeout(timeout time.Duration)
SetConnectTimeout 设置与server的连接超时时间.
func (*ServerConnectorConfigImpl) SetConnectionIdleTimeout ¶
func (s *ServerConnectorConfigImpl) SetConnectionIdleTimeout(timeout time.Duration)
SetConnectionIdleTimeout 设置连接空闲后超时时间.
func (*ServerConnectorConfigImpl) SetDefault ¶
func (s *ServerConnectorConfigImpl) SetDefault()
SetDefault 设置ServerConnector配置的默认值.
func (*ServerConnectorConfigImpl) SetMessageTimeout ¶
func (s *ServerConnectorConfigImpl) SetMessageTimeout(timeout time.Duration)
SetMessageTimeout 设置远程请求超时时间.
func (*ServerConnectorConfigImpl) SetPluginConfig ¶
func (s *ServerConnectorConfigImpl) SetPluginConfig(pluginName string, value BaseConfig) error
SetPluginConfig 输出插件具体配置.
func (*ServerConnectorConfigImpl) SetProtocol ¶
func (s *ServerConnectorConfigImpl) SetProtocol(protocol string)
SetProtocol 设置与cl5 server对接的协议.
func (*ServerConnectorConfigImpl) SetReconnectInterval ¶
func (s *ServerConnectorConfigImpl) SetReconnectInterval(interval time.Duration)
SetReconnectInterval 一次连接失败后,到下一次连接之间的最小间隔时间.
func (*ServerConnectorConfigImpl) SetRequestQueueSize ¶
func (s *ServerConnectorConfigImpl) SetRequestQueueSize(queueSize int32)
SetRequestQueueSize 设置新请求的队列BUFFER容量.
func (*ServerConnectorConfigImpl) SetServerSwitchInterval ¶
func (s *ServerConnectorConfigImpl) SetServerSwitchInterval(interval time.Duration)
SetServerSwitchInterval server的切换时延.
func (*ServerConnectorConfigImpl) Verify ¶
func (s *ServerConnectorConfigImpl) Verify() error
Verify 检验ServerConnector配置.
type ServerServices ¶
type ServerServices map[ClusterType]ClusterService
ServerServices 系统服务列表数据.
func GetServerServices ¶
func GetServerServices(cfg Configuration) ServerServices
GetServerServices 获取系统服务列表.
func (ServerServices) GetClusterService ¶
func (s ServerServices) GetClusterService(clsType ClusterType) *ClusterService
GetClusterService 获取集群服务.
type ServiceRouterConfig ¶
type ServiceRouterConfig interface { BaseConfig PluginConfig // GetChain consumer.serviceRouter.chain // 路由责任链配置 GetChain() []string // GetChain consumer.serviceRouter.afterChain // 路由责任链后置路由配置 GetAfterChain() []string // SetChain 设置路由责任链配置 SetChain([]string) // GetPercentOfMinInstances 获取PercentOfMinInstances参数 GetPercentOfMinInstances() float64 // SetPercentOfMinInstances 设置PercentOfMinInstances参数 SetPercentOfMinInstances(float64) // IsEnableRecoverAll 是否启用全死全活机制 IsEnableRecoverAll() bool // SetEnableRecoverAll 设置启用全死全活机制 SetEnableRecoverAll(bool) // GetNearbyConfig 获取就近路由配置 GetNearbyConfig() NearbyConfig }
ServiceRouterConfig 服务路由相关配置项.
type ServiceRouterConfigImpl ¶
type ServiceRouterConfigImpl struct { // 服务路由责任链 Chain []string `yaml:"chain" json:"chain"` // 服务路由责任链 AfterChain []string `yaml:"afterChain" json:"afterChain"` // 插件相关配置 Plugin PluginConfigs `yaml:"plugin" json:"plugin"` // 进行过滤时的最大过滤比例 PercentOfMinInstances *float64 `yaml:"percentOfMinInstances" json:"percentOfMinInstances"` // 是否启用全死全活机制 EnableRecoverAll *bool `yaml:"enableRecoverAll" json:"enableRecoverAll"` }
ServiceRouterConfigImpl 服务路由配置.
func (*ServiceRouterConfigImpl) GetAfterChain ¶ added in v1.5.0
func (s *ServiceRouterConfigImpl) GetAfterChain() []string
GetAfterChain consumer.serviceRouter.afterChain 路由责任链后置路由配置.
func (*ServiceRouterConfigImpl) GetChain ¶
func (s *ServiceRouterConfigImpl) GetChain() []string
GetChain consumer.serviceRouter.filterChain 路由责任链配置.
func (*ServiceRouterConfigImpl) GetNearbyConfig ¶
func (s *ServiceRouterConfigImpl) GetNearbyConfig() NearbyConfig
GetNearbyConfig 获取就近路由配置.
func (*ServiceRouterConfigImpl) GetPercentOfMinInstances ¶
func (s *ServiceRouterConfigImpl) GetPercentOfMinInstances() float64
GetPercentOfMinInstances 获取PercentOfMinInstances参数.
func (*ServiceRouterConfigImpl) GetPluginConfig ¶
func (s *ServiceRouterConfigImpl) GetPluginConfig(pluginName string) BaseConfig
GetPluginConfig consumer.serviceRouter.plugin.
func (*ServiceRouterConfigImpl) IsEnableRecoverAll ¶
func (s *ServiceRouterConfigImpl) IsEnableRecoverAll() bool
IsEnableRecoverAll 是否启用全死全活机制.
func (*ServiceRouterConfigImpl) SetAfterChain ¶ added in v1.5.0
func (s *ServiceRouterConfigImpl) SetAfterChain(chain []string)
SetAfterChain 设置路由责任链配置.
func (*ServiceRouterConfigImpl) SetChain ¶
func (s *ServiceRouterConfigImpl) SetChain(chain []string)
SetChain 设置路由责任链配置.
func (*ServiceRouterConfigImpl) SetDefault ¶
func (s *ServiceRouterConfigImpl) SetDefault()
SetDefault 设置ServiceRouterConfig配置的默认值.
func (*ServiceRouterConfigImpl) SetEnableRecoverAll ¶
func (s *ServiceRouterConfigImpl) SetEnableRecoverAll(recoverAll bool)
SetEnableRecoverAll 设置启用全死全活机制.
func (*ServiceRouterConfigImpl) SetPercentOfMinInstances ¶
func (s *ServiceRouterConfigImpl) SetPercentOfMinInstances(percent float64)
SetPercentOfMinInstances 设置PercentOfMinInstances参数.
func (*ServiceRouterConfigImpl) SetPluginConfig ¶
func (s *ServiceRouterConfigImpl) SetPluginConfig(pluginName string, value BaseConfig) error
SetPluginConfig 输出插件具体配置.
func (*ServiceRouterConfigImpl) Verify ¶
func (s *ServiceRouterConfigImpl) Verify() error
Verify 检验ServiceRouterConfig配置.
type ServiceSpecific ¶
type ServiceSpecific struct { Namespace string `yaml:"namespace" json:"namespace"` Service string `yaml:"service" json:"service"` ServiceRouter *ServiceRouterConfigImpl `yaml:"serviceRouter" json:"serviceRouter"` CircuitBreaker *CircuitBreakerConfigImpl `yaml:"circuitBreaker" json:"circuitBreaker"` }
ServiceSpecific .
func (*ServiceSpecific) GetServiceCircuitBreaker ¶
func (s *ServiceSpecific) GetServiceCircuitBreaker() CircuitBreakerConfig
GetServiceCircuitBreaker 获取熔断器
func (*ServiceSpecific) GetServiceRouter ¶
func (s *ServiceSpecific) GetServiceRouter() ServiceRouterConfig
GetServiceRouter 获取路由
type ServiceSpecificConfig ¶
type ServiceSpecificConfig interface { BaseConfig GetServiceCircuitBreaker() CircuitBreakerConfig GetServiceRouter() ServiceRouterConfig }
ServiceSpecificConfig 配置.
type ServicesSpecificImpl ¶
type ServicesSpecificImpl struct {
Services []*ServiceSpecific
}
ServicesSpecificImpl .
type StatReporterConfig ¶
type StatReporterConfig interface { BaseConfig PluginConfig // IsEnable 是否启用上报 IsEnable() bool // SetEnable 设置是否启用上报 SetEnable(bool) // GetChain 统计上报器插件链 GetChain() []string // SetChain 设置统计上报器插件链 SetChain([]string) }
StatReporterConfig 统计上报配置.
type StatReporterConfigImpl ¶
type StatReporterConfigImpl struct { // 是否启动上报 Enable *bool `yaml:"enable" json:"enable"` // 上报插件链 Chain []string `yaml:"chain" json:"chain"` // 插件相关配置 Plugin PluginConfigs `yaml:"plugin" json:"plugin"` }
StatReporterConfigImpl global.statReporter.
func (*StatReporterConfigImpl) GetChain ¶
func (s *StatReporterConfigImpl) GetChain() []string
GetChain 插件链条.
func (*StatReporterConfigImpl) GetPluginConfig ¶
func (s *StatReporterConfigImpl) GetPluginConfig(name string) BaseConfig
GetPluginConfig 获取一个插件的配置.
func (*StatReporterConfigImpl) IsEnable ¶
func (s *StatReporterConfigImpl) IsEnable() bool
IsEnable 是否启用上报.
func (*StatReporterConfigImpl) SetChain ¶
func (s *StatReporterConfigImpl) SetChain(chain []string)
SetChain 设置插件链条.
func (*StatReporterConfigImpl) SetDefault ¶
func (s *StatReporterConfigImpl) SetDefault()
SetDefault 设置statReporter默认值.
func (*StatReporterConfigImpl) SetEnable ¶
func (s *StatReporterConfigImpl) SetEnable(enable bool)
SetEnable 设置是否启用上报.
func (*StatReporterConfigImpl) SetPluginConfig ¶
func (s *StatReporterConfigImpl) SetPluginConfig(plugName string, value BaseConfig) error
SetPluginConfig 输出插件具体配置.
func (*StatReporterConfigImpl) Verify ¶
func (s *StatReporterConfigImpl) Verify() error
Verify 检测statReporter配置.
type SystemConfig ¶
type SystemConfig interface { BaseConfig // GetMode global.systemConfig.mode // SDK运行模式,agent还是noagent GetMode() model.RunMode // SetMode 设置SDK运行模式 SetMode(model.RunMode) // GetDiscoverCluster global.systemConfig.discoverCluster // 服务发现集群 GetDiscoverCluster() ServerClusterConfig // GetHealthCheckCluster global.systemConfig.healthCheckCluster // 健康检查集群 GetHealthCheckCluster() ServerClusterConfig // GetMonitorCluster global.systemConfig.monitorCluster // 监控上报集群 GetMonitorCluster() ServerClusterConfig // GetVariable global.systemConfig.variables // 获取一个路由环境变量 GetVariable(key string) (string, bool) // SetVariable global.systemConfig.variables // 设置一个路由环境变量 SetVariable(key, value string) // UnsetVariable 取消一个路由环境变量 UnsetVariable(key string) }
SystemConfig 系统配置信息.
type SystemConfigImpl ¶
type SystemConfigImpl struct { // SDK运行模式 Mode model.RunMode `yaml:"mode" json:"mode"` // 服务发现集群 DiscoverCluster *ServerClusterConfigImpl `yaml:"discoverCluster" json:"discoverCluster"` // 健康检查集群 HealthCheckCluster *ServerClusterConfigImpl `yaml:"healthCheckCluster" json:"healthCheckCluster"` // 监控上报集群 MonitorCluster *ServerClusterConfigImpl `yaml:"monitorCluster" json:"monitorCluster"` // 传入的路由规则variables Variables map[string]string `yaml:"variables" json:"variables"` }
SystemConfigImpl 系统配置.
func (*SystemConfigImpl) GetDiscoverCluster ¶
func (s *SystemConfigImpl) GetDiscoverCluster() ServerClusterConfig
GetDiscoverCluster 服务发现集群.
func (*SystemConfigImpl) GetHealthCheckCluster ¶
func (s *SystemConfigImpl) GetHealthCheckCluster() ServerClusterConfig
GetHealthCheckCluster 健康检查集群.
func (*SystemConfigImpl) GetMode ¶
func (s *SystemConfigImpl) GetMode() model.RunMode
GetMode SDK运行模式,agent还是noagent.
func (*SystemConfigImpl) GetMonitorCluster ¶
func (s *SystemConfigImpl) GetMonitorCluster() ServerClusterConfig
GetMonitorCluster 监控上报集群.
func (*SystemConfigImpl) GetVariable ¶
func (s *SystemConfigImpl) GetVariable(key string) (string, bool)
GetVariable 获取一个路由variable.
func (*SystemConfigImpl) SetDefault ¶
func (s *SystemConfigImpl) SetDefault()
SetDefault 设置systemConfig默认值.
func (*SystemConfigImpl) SetMode ¶
func (s *SystemConfigImpl) SetMode(mode model.RunMode)
SetMode 设置SDK运行模式.
func (*SystemConfigImpl) SetVariable ¶
func (s *SystemConfigImpl) SetVariable(key, value string)
SetVariable 设置一个路由variable.
func (*SystemConfigImpl) UnsetVariable ¶
func (s *SystemConfigImpl) UnsetVariable(key string)
UnsetVariable 取消一个路由variable.
func (*SystemConfigImpl) Verify ¶
func (s *SystemConfigImpl) Verify() error
Verify 校验systemConfig配置.