archaius

package
v0.0.0-...-5dc8409 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultForceFallback             = false
	DefaultTimeoutEnabled            = false
	DefaultCircuitBreakerEnabled     = true
	DefaultCircuitBreakerForceOpen   = false
	DefaultCircuitBreakerForceClosed = false
	DefaultFallbackEnable            = true
	DefaultMaxConcurrent             = 1000
	DefaultSleepWindow               = 15000
	DefaultTimeout                   = 30000
	DefaultErrorPercentThreshold     = 50
	DefaultRequestVolumeThreshold    = 20
	PolicyNull                       = "returnnull"
	PolicyThrowException             = "throwexception"
)

constant for hystrix parameters

View Source
const (
	DefaultAbortPercent = 0
	DefaultAbortStatus  = 0
	DefaultDelayPercent = 0
)

constant for default values of abort and delay

View Source
const (
	FixedPrefix = "cse"

	NamespaceIsolation                = "isolation"
	NamespaceCircuitBreaker           = "circuitBreaker"
	NamespaceFallback                 = "fallback" //降级
	NamespaceFallbackpolicy           = "fallbackpolicy"
	PropertyTimeoutInMilliseconds     = "timeoutInMilliseconds"
	PropertyTimeoutEnabled            = "timeout.enabled"
	PropertyMaxConcurrentRequests     = "maxConcurrentRequests"
	PropertyErrorThresholdPercentage  = "errorThresholdPercentage"  //失败率
	PropertyRequestVolumeThreshold    = "requestVolumeThreshold"    //窗口请求数
	PropertySleepWindowInMilliseconds = "sleepWindowInMilliseconds" //熔断时间窗
	PropertyEnabled                   = "enabled"
	PropertyForce                     = "force"
	PropertyPolicy                    = "policy"
	PropertyForceClosed               = "forceClosed"
	PropertyForceOpen                 = "forceOpen"
	PropertyFault                     = "fault"
	PropertyGlobal                    = "_global"
	PropertyGovernance                = "governance"
	PropertyConsumer                  = "Consumer"
	PropertySchema                    = "schemas"
	PropertyOperations                = "operations"
	PropertyProtocol                  = "protocols"
	PropertyAbort                     = "abort"
	PropertyPercent                   = "percent"
	PropertyFixedDelay                = "fixedDelay"
	PropertyDelay                     = "delay"
	PropertyHTTPStatus                = "httpStatus"

	LoadBalance = "loadbalance"
)

constant for hystrix keys

Variables

This section is empty.

Functions

func AddDI

func AddDI(dimensionInfo string) (map[string]string, error)

AddDI adds a NewDimensionInfo of which configurations needs to be taken

func AddFile

func AddFile(file string) error

AddFile is for to add the configuration files into the configfactory at run time

func AddKeyValue

func AddKeyValue(key string, value interface{}) error

AddKeyValue is for to add the configuration key, value pairs into the configfactory at run time

func Exist

func Exist(key string) bool

Exist is check the configuration key existence

func Get

func Get(key string) interface{}

Get is for to get the value of configuration key

func GetAbortPercent

func GetAbortPercent(protocol, microServiceName, schema, operation string) int

GetAbortPercent get abort percentage

func GetAbortStatus

func GetAbortStatus(protocol, microServiceName, schema, operation string) int

GetAbortStatus get abort status

func GetBool

func GetBool(key string, defaultValue bool) bool

GetBool is gives the key value in the form of bool

func GetCircuitBreakerEnabled

func GetCircuitBreakerEnabled(command, t string) bool

GetCircuitBreakerEnabled get circuit breaker enabled

func GetCircuitBreakerEnabledKey

func GetCircuitBreakerEnabledKey(command string) string

GetCircuitBreakerEnabledKey get circuit breaker enabled key

func GetConfigs

func GetConfigs() map[string]interface{}

GetConfigs gives the information about all configurations

func GetConfigsByDI

func GetConfigsByDI(dimensionInfo string) map[string]interface{}

GetConfigsByDI is for to get the all configurations received dimensionInfo

func GetDefaultCircuitBreakerEnabledKey

func GetDefaultCircuitBreakerEnabledKey(t string) string

GetDefaultCircuitBreakerEnabledKey get default circuit breaker enabled key

func GetDefaultErrorPercentThreshold

func GetDefaultErrorPercentThreshold(t string) string

GetDefaultErrorPercentThreshold get default error percentage threshold value

func GetDefaultFallbackPolicyKey

func GetDefaultFallbackPolicyKey(t string) string

GetDefaultFallbackPolicyKey get default fallback policy key

func GetDefaultForceCloseKey

func GetDefaultForceCloseKey(t string) string

GetDefaultForceCloseKey get default force close key

func GetDefaultForceFallbackKey

func GetDefaultForceFallbackKey(t string) string

GetDefaultForceFallbackKey get default force fallback key

func GetDefaultForceOpenKey

func GetDefaultForceOpenKey(t string) string

GetDefaultForceOpenKey get default force open key

func GetDefaultGetFallbackEnabledKey

func GetDefaultGetFallbackEnabledKey(t string) string

GetDefaultGetFallbackEnabledKey get default fallback enabled key

func GetDefaultMaxConcurrentKey

func GetDefaultMaxConcurrentKey(t string) string

GetDefaultMaxConcurrentKey get default maximum concurrent key

func GetDefaultRequestVolumeThresholdKey

func GetDefaultRequestVolumeThresholdKey(t string) string

GetDefaultRequestVolumeThresholdKey get default request volume threshold key

func GetDefaultSleepWindowKey

func GetDefaultSleepWindowKey(t string) string

GetDefaultSleepWindowKey get default sleep window key

func GetDefaultTimeEnabledKey

func GetDefaultTimeEnabledKey(t string) string

GetDefaultTimeEnabledKey get default time enabled key

func GetDefaultTimeoutKey

func GetDefaultTimeoutKey(t string) string

GetDefaultTimeoutKey get default timeout key

func GetDelayPercent

func GetDelayPercent(protocol, microServiceName, schema, operation string) int

GetDelayPercent get delay percentage

func GetErrorPercentThreshold

func GetErrorPercentThreshold(command, t string) int

GetErrorPercentThreshold is to get error percentage threshold

func GetErrorPercentThresholdKey

func GetErrorPercentThresholdKey(command string) string

GetErrorPercentThresholdKey get error percentage threshold key

func GetFallbackEnabled

func GetFallbackEnabled(command, t string) bool

GetFallbackEnabled get fallback enabled

func GetFallbackEnabledKey

func GetFallbackEnabledKey(command string) string

GetFallbackEnabledKey get fallback enabled key

func GetFallbackPolicyKey

func GetFallbackPolicyKey(command string) string

GetFallbackPolicyKey get fallback policy key

func GetFaultAbortHTTPStatusKey

func GetFaultAbortHTTPStatusKey(key, protocol string) string

GetFaultAbortHTTPStatusKey get fault abort http status key

func GetFaultAbortPercentKey

func GetFaultAbortPercentKey(key, protocol string) string

GetFaultAbortPercentKey get fault abort percentage key

func GetFaultDelayPercentKey

func GetFaultDelayPercentKey(key, protocol string) string

GetFaultDelayPercentKey get fault daley percentage key

func GetFaultFixedDelayKey

func GetFaultFixedDelayKey(key, protocol string) string

GetFaultFixedDelayKey get fault fixed delay key

func GetFaultInjectionGlobalKey

func GetFaultInjectionGlobalKey() string

GetFaultInjectionGlobalKey get fault injection global key

func GetFaultInjectionOperationKey

func GetFaultInjectionOperationKey(microServiceName, schema, operation string) string

GetFaultInjectionOperationKey get fault injection operation key

func GetFaultInjectionSchemaKey

func GetFaultInjectionSchemaKey(microServiceName, schema string) string

GetFaultInjectionSchemaKey get fault injection schema key

func GetFaultInjectionServiceKey

func GetFaultInjectionServiceKey(microServiceName string) string

GetFaultInjectionServiceKey get fault injection service key

func GetFilterNamesKey

func GetFilterNamesKey() string

GetFilterNamesKey get filer name and key

func GetFixedDelay

func GetFixedDelay(protocol, microServiceName, schema, operation string) time.Duration

GetFixedDelay get fixed delay

func GetFloat64

func GetFloat64(key string, defaultValue float64) float64

GetFloat64 gives the key value in the form of float64

func GetForceClose

func GetForceClose(command, t string) bool

GetForceClose get force close

func GetForceCloseKey

func GetForceCloseKey(command string) string

GetForceCloseKey get force close key

func GetForceFallback

func GetForceFallback(command, t string) bool

GetForceFallback get force fallback

func GetForceFallbackKey

func GetForceFallbackKey(command string) string

GetForceFallbackKey get force fallback key

func GetForceOpen

func GetForceOpen(command, t string) bool

GetForceOpen get force open

func GetForceOpenKey

func GetForceOpenKey(command string) string

GetForceOpenKey get force open key

func GetHystrixSpecificKey

func GetHystrixSpecificKey(namespace, cmd, property string) string

GetHystrixSpecificKey get hystrix specific key

func GetInt

func GetInt(key string, defaultValue int) int

GetInt gives the key value in the form of GetInt

func GetMaxConcurrentKey

func GetMaxConcurrentKey(command string) string

GetMaxConcurrentKey get maximum concurrent key

func GetMaxConcurrentRequests

func GetMaxConcurrentRequests(command, t string) int

GetMaxConcurrentRequests is to get maximum concurrent requests

func GetPolicy

func GetPolicy(command, t string) string

GetPolicy get policy

func GetRequestVolumeThreshold

func GetRequestVolumeThreshold(command, t string) int

GetRequestVolumeThreshold is to get request volume threshold

func GetRequestVolumeThresholdKey

func GetRequestVolumeThresholdKey(command string) string

GetRequestVolumeThresholdKey get request volume threshold key

func GetServerListFilters

func GetServerListFilters() []string

GetServerListFilters get server list filters

func GetSleepWindow

func GetSleepWindow(command, t string) int

GetSleepWindow get sleep window

func GetSleepWindowKey

func GetSleepWindowKey(command string) string

GetSleepWindowKey get sleep window key

func GetString

func GetString(key string, defaultValue string) string

GetString gives the key value in the form of GetString

func GetStringByDI

func GetStringByDI(dimensionInfo, key string, defaultValue string) string

GetStringByDI is for to get the value of configuration key based on dimension info

func GetTimeEnabledKey

func GetTimeEnabledKey(command string) string

GetTimeEnabledKey get time enabled key

func GetTimeout

func GetTimeout(command, t string) int

GetTimeout get is to get timeout period

func GetTimeoutEnabled

func GetTimeoutEnabled(command, t string) bool

GetTimeoutEnabled get timeout enabled

func GetTimeoutKey

func GetTimeoutKey(command string) string

GetTimeoutKey get timeout key

func Init

func Init() error

Init is to initialize the archaius

func PathExist

func PathExist(_path string) bool

PathExist to check the existence of the file path

func RegisterListener

func RegisterListener(listenerObj core.EventListener, key ...string) error

RegisterListener to Register all listener for different key changes, each key could be a regular expression

func UnRegisterListener

func UnRegisterListener(listenerObj core.EventListener, key ...string) error

UnRegisterListener is to remove the listener

func UnmarshalConfig

func UnmarshalConfig(obj interface{}) error

UnmarshalConfig is for unmarshalling the configuraions of receiving object

Types

type Config

type Config struct {
	ConfigFiles   []string
	ConfigFactory goarchaius.ConfigurationFactory
}

Config is the struct of configuration files, and configuration factory

var DefaultConf *Config

DefaultConf is the variable having information about configuration files, and configuration factory

func NewConfig

func NewConfig(essentialfiles, commonfiles []string) (*Config, error)

NewConfig is gives the object of Config(it is having configuration files, and configuration factory)

type ConfigListener

type ConfigListener struct{}

ConfigListener is provides the object to listen the events

func (*ConfigListener) Event

func (cl *ConfigListener) Event(e *core.Event)

Event is for to receive the events based on registered key and object pairs

type EventListener

type EventListener struct {
	Name    string
	Factory goarchaius.ConfigurationFactory
}

EventListener is a struct having information about registering key and object

func (EventListener) Event

func (e EventListener) Event(event *core.Event)

Event is invoked while generating events at run time

Jump to

Keyboard shortcuts

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