model

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2018 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConsumerType = "Consumer"
	ProviderType = "Provider"
)

constant for consumer and provider

Variables

View Source
var (
	//default config fo hystric.
	DefaultIsolation = IsolationPropertyStruct{
		Timeout:               Timeout{true},
		TimeoutInMilliseconds: 1000,
		MaxConcurrentRequests: 4000,
	}
	DefaultCircuit = CircuitBreakPropertyStruct{
		Enabled:                   true,
		ForceOpen:                 false,
		ForceClose:                false,
		SleepWindowInMilliseconds: 5000,
		RequestVolumeThreshold:    20,
		ErrorThresholdPercentage:  50,
	}
	DefaultFallback = FallbackPropertyStruct{
		Enabled:               true,
		MaxConcurrentRequests: 4000,
	}
)

variables of isolation, circuit, fallback

Functions

This section is empty.

Types

type Abort

type Abort struct {
	Percent    int `yaml:"percent"`
	HTTPStatus int `yaml:"httpStatus"`
}

Abort abort struct

type BackoffStrategy

type BackoffStrategy struct {
	Kind  string `yaml:"kind"`
	MinMs int    `yaml:"minMs"`
	MaxMs int    `yaml:"maxMs"`
}

BackoffStrategy back off strategy

type ChainStruct

type ChainStruct struct {
	Consumer map[string]string `yaml:"Consumer"`
	Provider map[string]string `yaml:"Provider"`
}

ChainStruct 调用链信息

type CircuitBreakPropertyStruct

type CircuitBreakPropertyStruct struct {
	Enabled                   bool `yaml:"enabled"`
	ForceOpen                 bool `yaml:"forceOpen"`
	ForceClose                bool `yaml:"forceClosed"`
	SleepWindowInMilliseconds int  `yaml:"sleepWindowInMilliseconds"`
	RequestVolumeThreshold    int  `yaml:"requestVolumeThreshold"`
	ErrorThresholdPercentage  int  `yaml:"errorThresholdPercentage"`
}

CircuitBreakPropertyStruct circuitBreaker 属性集合

type CircuitBreakerSpec

type CircuitBreakerSpec struct {
	Enabled                   bool                                  `yaml:"enabled"`
	ForceOpen                 bool                                  `yaml:"forceOpen"`
	ForceClose                bool                                  `yaml:"forceClosed"`
	SleepWindowInMilliseconds int                                   `yaml:"sleepWindowInMilliseconds"`
	RequestVolumeThreshold    int                                   `yaml:"requestVolumeThreshold"`
	ErrorThresholdPercentage  int                                   `yaml:"errorThresholdPercentage"`
	AnyService                map[string]CircuitBreakPropertyStruct `yaml:",inline"`
}

CircuitBreakerSpec circuit breaker specifications

type CircuitWrapper

type CircuitWrapper struct {
	Consumer *CircuitBreakerSpec `yaml:"Consumer"`
	Provider *CircuitBreakerSpec `yaml:"Provider"`
}

CircuitWrapper circuit wrapper structure

type ClientStruct

type ClientStruct struct {
	Type              string                 `yaml:"type"`
	ServerURI         string                 `yaml:"serverUri"`
	TenantName        string                 `yaml:"tenantName"`
	RefreshMode       int                    `yaml:"refreshMode"`
	RefreshInterval   int                    `yaml:"refreshInterval"`
	RefreshPort       string                 `yaml:"refreshPort"`
	Autodiscovery     bool                   `yaml:"autodiscovery"`
	APIVersion        ConfigAPIVersionStruct `yaml:"api"`
	ApolloServiceName string                 `yaml:"serviceName"`
	ApolloEnv         string                 `yaml:"env"`
	ApolloNameSpace   string                 `yaml:"namespace"`
	ApolloToken       string                 `yaml:"token"`
	ClusterName       string                 `yaml:"cluster"`
	Enabled           bool                   `yaml:"enabled"`
}

ClientStruct client structure

type ConfigAPIVersionStruct

type ConfigAPIVersionStruct struct {
	Version string `yaml:"version"`
}

ConfigAPIVersionStruct is the structure for configuration API version

type ConfigStruct

type ConfigStruct struct {
	Client ClientStruct `yaml:"client"`
}

ConfigStruct configuration structure

type ContractDiscoveryStruct

type ContractDiscoveryStruct struct {
	Disable         bool                     `yaml:"disabled"`
	Type            string                   `yaml:"type"`
	Address         string                   `yaml:"address"`
	RefreshInterval string                   `yaml:"refreshInterval"`
	Tenant          string                   `yaml:"tenant"`
	APIVersion      RegistryAPIVersionStruct `yaml:"api"`
}

ContractDiscoveryStruct contract discovery config struct

type ControlPanel added in v0.7.1

type ControlPanel struct {
	Infra    string            `yaml:"infra"`
	Settings map[string]string `yaml:"settings"`
}

ControlPanel define control panel config

type CredentialStruct

type CredentialStruct struct {
	AccessKey        string `yaml:"accessKey"`
	SecretKey        string `yaml:"secretKey"`
	AkskCustomCipher string `yaml:"akskCustomCipher"`
	Project          string `yaml:"project"`
}

CredentialStruct aksk信息

type CseStruct

type CseStruct struct {
	Config      ConfigStruct                `yaml:"config"`
	Service     ServiceStruct               `yaml:"service"`
	Protocols   map[string]Protocol         `yaml:"protocols"`
	Handler     HandlerStruct               `yaml:"handler"`
	References  map[string]ReferencesStruct `yaml:"references"`
	FlowControl FlowControl                 `yaml:"flowcontrol"`
	Monitor     MonitorStruct               `yaml:"monitor"`
	Metrics     MetricsStruct               `yaml:"metrics"`
	Credentials CredentialStruct            `yaml:"credentials"`
}

CseStruct 设置注册中心SC的地址,要开哪些传输协议, 调用链信息等

type DarkLaunchRule

type DarkLaunchRule struct {
	Type  string      `json:"policyType"` // RULE/RATE
	Items []*RuleItem `json:"ruleItems"`
}

DarkLaunchRule dark launch rule

type DataCenterInfo

type DataCenterInfo struct {
	Name          string `yaml:"name"`
	Region        string `yaml:"region"`
	AvailableZone string `yaml:"availableZone"`
}

DataCenterInfo gives data center information

type Delay

type Delay struct {
	Percent    int           `yaml:"percent"`
	FixedDelay time.Duration `yaml:"fixedDelay"`
}

Delay delay struct

type FallbackPolicyPropertyStruct

type FallbackPolicyPropertyStruct struct {
	Policy string `yaml:"policy"`
}

FallbackPolicyPropertyStruct fallback policy property structure

type FallbackPolicySpec

type FallbackPolicySpec struct {
	Policy     string                                  `yaml:"policy"`
	AnyService map[string]FallbackPolicyPropertyStruct `yaml:",inline"`
}

FallbackPolicySpec fallback policy specifications

type FallbackPolicyWrapper

type FallbackPolicyWrapper struct {
	Consumer *FallbackPolicySpec `yaml:"Consumer"`
	Provider *FallbackPolicySpec `yaml:"Provider"`
}

FallbackPolicyWrapper fallback policy wrapper

type FallbackPropertyStruct

type FallbackPropertyStruct struct {
	Enabled               bool `yaml:"enabled"`
	Force                 bool `yaml:"force"`
	MaxConcurrentRequests int  `yaml:"maxConcurrentRequests"`
}

FallbackPropertyStruct fallback property structure

type FallbackSpec

type FallbackSpec struct {
	Enabled               bool                              `yaml:"enabled"`
	Force                 bool                              `yaml:"force"`
	MaxConcurrentRequests int                               `yaml:"maxConcurrentRequests"`
	AnyService            map[string]FallbackPropertyStruct `yaml:",inline"`
}

FallbackSpec fallback specifications

type FallbackWrapper

type FallbackWrapper struct {
	Consumer *FallbackSpec `yaml:"Consumer"`
	Provider *FallbackSpec `yaml:"Provider"`
}

FallbackWrapper fallback wrapper structure

type Fault

type Fault struct {
	Abort Abort `yaml:"abort"`
	Delay Delay `yaml:"delay"`
}

Fault fault struct

type FaultProtocolStruct

type FaultProtocolStruct struct {
	Fault map[string]Fault `yaml:"protocols"`
}

FaultProtocolStruct fault protocol struct

type FlowControl added in v0.7.1

type FlowControl struct {
	Consumer QPS `yaml:"Consumer"`
	Provider QPS `yaml:"Provider"`
}

FlowControl used to define rate limiting

type GlobalCfg

type GlobalCfg struct {
	AppID      string            `yaml:"APPLICATION_ID"`
	Cse        CseStruct         `yaml:"cse"`
	Panel      ControlPanel      `yaml:"control"`
	Ssl        map[string]string `yaml:"ssl"`
	Tracing    TracingStruct     `yaml:"tracing"`
	DataCenter *DataCenterInfo   `yaml:"region"`
}

GlobalCfg chassis.yaml 配置项

type HandlerStruct

type HandlerStruct struct {
	Chain ChainStruct `yaml:"chain"`
}

HandlerStruct 调用链信息

type HystrixConfig

type HystrixConfig struct {
	IsolationProperties      *IsolationWrapper      `yaml:"isolation"`
	CircuitBreakerProperties *CircuitWrapper        `yaml:"circuitBreaker"`
	FallbackProperties       *FallbackWrapper       `yaml:"fallback"`
	FallbackPolicyProperties *FallbackPolicyWrapper `yaml:"fallbackpolicy"`
}

HystrixConfig is hystrix configuration structure

type HystrixConfigWrapper

type HystrixConfigWrapper struct {
	HystrixConfig *HystrixConfig `yaml:"cse"`
}

HystrixConfigWrapper hystrix configuration wrapper structure

func (*HystrixConfigWrapper) String

func (hc *HystrixConfigWrapper) String() ([]byte, error)

String returns marshalling data of hystrix config wrapper

type IsolationPropertyStruct

type IsolationPropertyStruct struct {
	Timeout               Timeout `yaml:"timeout"`
	TimeoutInMilliseconds int     `yaml:"timeoutInMilliseconds"`
	MaxConcurrentRequests int     `yaml:"maxConcurrentRequests"`
}

IsolationPropertyStruct isolation 属性集合

type IsolationSpec

type IsolationSpec struct {
	TimeoutEnable         Timeout                  `yaml:"timeout"`
	TimeoutInMilliseconds int                      `yaml:"timeoutInMilliseconds"`
	MaxConcurrentRequests int                      `yaml:"maxConcurrentRequests"`
	AnyService            map[string]IsolationSpec `yaml:",inline"`
}

IsolationSpec isolation speciafications

type IsolationWrapper

type IsolationWrapper struct {
	Consumer *IsolationSpec `yaml:"Consumer"`
	Provider *IsolationSpec `yaml:"Provider"`
}

IsolationWrapper isolation wrapper structure

type LBWrapper

type LBWrapper struct {
	Prefix *LoadBalancingConfig `yaml:"cse"`
}

LBWrapper loadbalancing structure

type LoadBalancing

type LoadBalancing struct {
	Strategy              map[string]string            `yaml:"strategy"`
	RetryEnabled          bool                         `yaml:"retryEnabled"`
	RetryOnNext           int                          `yaml:"retryOnNext"`
	RetryOnSame           int                          `yaml:"retryOnSame"`
	Filters               string                       `yaml:"serverListFilters"`
	Backoff               BackoffStrategy              `yaml:"backoff"`
	SessionStickinessRule SessionStickinessRule        `yaml:"SessionStickinessRule"`
	AnyService            map[string]LoadBalancingSpec `yaml:",inline"`
}

LoadBalancing loadbalancing structure

type LoadBalancingConfig

type LoadBalancingConfig struct {
	LBConfig *LoadBalancing `yaml:"loadbalance"`
}

LoadBalancingConfig loadbalancing structure

type LoadBalancingSpec

type LoadBalancingSpec struct {
	Strategy              map[string]string     `yaml:"strategy"`
	SessionStickinessRule SessionStickinessRule `yaml:"SessionStickinessRule"`
	RetryEnabled          bool                  `yaml:"retryEnabled"`
	RetryOnNext           int                   `yaml:"retryOnNext"`
	RetryOnSame           int                   `yaml:"retryOnSame"`
	Backoff               BackoffStrategy       `yaml:"backoff"`
}

LoadBalancingSpec loadbalancing structure

type Match

type Match struct {
	Refer       string                       `yaml:"refer"`
	Source      string                       `yaml:"source"`
	SourceTags  map[string]string            `yaml:"sourceTags"`
	HTTPHeaders map[string]map[string]string `yaml:"httpHeaders"`
	Headers     map[string]map[string]string `yaml:"headers"`
}

Match is checking source, source tags, and http headers

type MetricsStruct

type MetricsStruct struct {
	APIPath                string `yaml:"apiPath"`
	FlushInterval          string `yaml:"flushInterval"`
	Enable                 bool   `yaml:"enable"`
	EnableGoRuntimeMetrics bool   `yaml:"enableGoRuntimeMetrics"`
}

MetricsStruct metrics struct

type MicServiceStruct

type MicServiceStruct struct {
	Name               string            `yaml:"name"`
	Hostname           string            `yaml:"hostname"`
	Version            string            `yaml:"version"`
	Environment        string            `yaml:"environment"`
	Level              string            `yaml:"level"`
	Properties         map[string]string `yaml:"properties"`
	InstanceProperties map[string]string `yaml:"instance_properties"`
}

MicServiceStruct 设置微服务的私有属性

type MicroserviceCfg

type MicroserviceCfg struct {
	AppID              string           `yaml:"APPLICATION_ID"`
	Provider           string           `yaml:"Provider"`
	ServiceDescription MicServiceStruct `yaml:"service_description"`
}

MicroserviceCfg microservice.yaml 配置项

type MonitorAPIVersionStruct

type MonitorAPIVersionStruct struct {
	Version string `yaml:"version"`
}

MonitorAPIVersionStruct monitor API version struct

type MonitorClientStruct

type MonitorClientStruct struct {
	ServerURI  string                  `yaml:"serverUri"`
	Enable     bool                    `yaml:"enable"`
	UserName   string                  `yaml:"userName"`
	DomainName string                  `yaml:"domainName"`
	APIVersion MonitorAPIVersionStruct `yaml:"api"`
}

MonitorClientStruct monitor client struct

type MonitorStruct

type MonitorStruct struct {
	Client MonitorClientStruct `yaml:"client"`
}

MonitorStruct is the struct for monitoring parameters

type PassLagerCfg

type PassLagerCfg struct {
	Writers        string `yaml:"writers"`
	LoggerLevel    string `yaml:"logger_level"`
	LoggerFile     string `yaml:"logger_file"`
	LogFormatText  bool   `yaml:"log_format_text"`
	RollingPolicy  string `yaml:"rollingPolicy"`
	LogRotateDate  int    `yaml:"log_rotate_date"`
	LogRotateSize  int    `yaml:"log_rotate_size"`
	LogBackupCount int    `yaml:"log_backup_count"`
}

PassLagerCfg is the struct for lager information(passlager.yaml)

type Protocol

type Protocol struct {
	Listen       string `yaml:"listenAddress"`
	Advertise    string `yaml:"advertiseAddress"`
	WorkerNumber int    `yaml:"workerNumber"`
	Transport    string `yaml:"transport"`
	Failure      string `yaml:"failure"`
}

Protocol protocol structure

type QPS added in v0.7.1

type QPS struct {
	QPS QPSProps `yaml:"qps"`
}

QPS is the struct to define QPS

type QPSProps added in v0.7.1

type QPSProps struct {
	Enabled bool              `yaml:"enabled"`
	Global  map[string]int    `yaml:"global"`
	Limit   map[string]string `yaml:"limit"`
}

QPSProps define rate limiting settings

type ReferencesStruct

type ReferencesStruct struct {
	Version   string `yaml:"version"`
	Transport string `yaml:"transport"`
}

ReferencesStruct references structure

type RegistratorStruct

type RegistratorStruct struct {
	Disable         bool                     `yaml:"disabled"`
	Type            string                   `yaml:"type"`
	Scope           string                   `yaml:"scope"`
	Address         string                   `yaml:"address"`
	RefreshInterval string                   `yaml:"refreshInterval"`
	Tenant          string                   `yaml:"tenant"`
	AutoRegister    string                   `yaml:"register"`
	APIVersion      RegistryAPIVersionStruct `yaml:"api"`
}

RegistratorStruct service registry config struct

type RegistryAPIVersionStruct

type RegistryAPIVersionStruct struct {
	Version string `yaml:"version"`
}

RegistryAPIVersionStruct registry api version structure

type RegistryStruct

type RegistryStruct struct {
	// NOTE: this part of struct would be deperacated later
	// please use registrator instead
	Disable         bool                     `yaml:"disabled"`
	Type            string                   `yaml:"type"`
	Scope           string                   `yaml:"scope"`
	AutoDiscovery   bool                     `yaml:"autodiscovery"`
	AutoIPIndex     bool                     `yaml:"autoIPIndex"`
	Address         string                   `yaml:"address"`
	RefreshInterval string                   `yaml:"refreshInterval"`
	Watch           bool                     `yaml:"watch"`
	Tenant          string                   `yaml:"tenant"`
	AutoRegister    string                   `yaml:"register"`
	APIVersion      RegistryAPIVersionStruct `yaml:"api"`

	// Use Registrator ServiceDiscovery and ContractDiscovery
	// to define information about service registry
	Registrator       RegistratorStruct       `yaml:"registrator"`
	ServiceDiscovery  ServiceDiscoveryStruct  `yaml:"serviceDiscovery"`
	ContractDiscovery ContractDiscoveryStruct `yaml:"contractDiscovery"`
	HealthCheck       bool                    `yaml:"healthCheck"`
	CacheIndex        bool                    `yaml:"cacheIndex"`
}

RegistryStruct SC information

type RouteRule

type RouteRule struct {
	Precedence int         `yaml:"precedence"`
	Routes     []*RouteTag `yaml:"route"`
	Match      Match       `yaml:"match"`
}

RouteRule is having route rule parameters

type RouteTag

type RouteTag struct {
	Tags   map[string]string `yaml:"tags"`
	Weight int               `yaml:"weight"`
	Label  string
}

RouteTag gives route tag information

type Router

type Router struct {
	Infra   string `yaml:"infra"`
	Address string `yaml:"address"`
}

Router define where rule comes from

type RouterConfig

type RouterConfig struct {
	Router          Router                  `yaml:"router"`
	Destinations    map[string][]*RouteRule `yaml:"routeRule"`
	SourceTemplates map[string]*Match       `yaml:"sourceTemplate"`
}

RouterConfig is the struct having info about route rule destinations, source templates

type RuleItem

type RuleItem struct {
	GroupName       string `json:"groupName"`
	GroupCondition  string `json:"groupCondition"`  // version=0.0.1
	PolicyCondition string `json:"policyCondition"` // 80/test!=2
}

RuleItem rule item

type ServiceDiscoveryStruct

type ServiceDiscoveryStruct struct {
	Disable         bool                     `yaml:"disabled"`
	Type            string                   `yaml:"type"`
	AutoDiscovery   bool                     `yaml:"autodiscovery"`
	AutoIPIndex     bool                     `yaml:"autoIPIndex"`
	Address         string                   `yaml:"address"`
	RefreshInterval string                   `yaml:"refreshInterval"`
	Watch           bool                     `yaml:"watch"`
	Tenant          string                   `yaml:"tenant"`
	ConfigPath      string                   `yaml:"configPath"`
	APIVersion      RegistryAPIVersionStruct `yaml:"api"`
	HealthCheck     bool                     `yaml:"healthCheck"`
}

ServiceDiscoveryStruct service discovery config struct

type ServiceStruct

type ServiceStruct struct {
	Registry RegistryStruct `yaml:"registry"`
}

ServiceStruct SC information

type SessionStickinessRule

type SessionStickinessRule struct {
	SessionTimeoutInSeconds int `yaml:"sessionTimeoutInSeconds"`
	SuccessiveFailedTimes   int `yaml:"successiveFailedTimes"`
}

SessionStickinessRule loadbalancing structure

type Timeout

type Timeout struct {
	Enabled bool `yaml:"enabled"`
}

Timeout time out

type TracingStruct

type TracingStruct struct {
	SamplingRate  float64 `yaml:"samplingRate"`
	CollectorType string  `yaml:"collectorType"` // http|log
	// if collectorType is http, the target is zipkin server
	// if collectorType is log, the target is log file
	CollectorTarget string `yaml:"collectorTarget"`
}

TracingStruct tracing structure

Jump to

Keyboard shortcuts

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