config

package
v0.0.0-...-e3e1183 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2019 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinHostWeight               = uint32(1)
	MaxHostWeight               = uint32(128)
	DefaultMaxRequestPerConn    = uint32(1024)
	DefaultConnBufferLimitBytes = uint32(16 * 1024)
)

Variables

This section is empty.

Functions

func AddClusterWithRouter

func AddClusterWithRouter(listenername string, clusters []v2.Cluster, routerConfig *v2.RouterConfiguration)

AddClusterWithRouter is a wrapper of AddOrUpdateCluster and AddOrUpdateRoutersConfig use this function to only dump config once

func AddMsgMeta

func AddMsgMeta(dataId, groupId string)

AddMsgMeta called when msg meta updated

func AddOrUpdateClusterConfig

func AddOrUpdateClusterConfig(clusters []v2.Cluster)

AddOrUpdateClusterConfig called when add cluster config info received

func AddOrUpdateRouterConfig

func AddOrUpdateRouterConfig(listenername string, routerConfig *v2.RouterConfiguration)

AddOrUpdateRouterConfig update the connection_manager's config

func AddOrUpdateStreamFilters

func AddOrUpdateStreamFilters(listenername string, typ string, cfg map[string]interface{})

AddOrUpdateStreamFilters update the stream filters config

func AddPubInfo

func AddPubInfo(pubInfoAdded map[string]string)

AddPubInfo called when add pub info received

func DelMsgMeta

func DelMsgMeta(dataId string)

DelMsgMeta called when delete msg meta received

func DelPubInfo

func DelPubInfo(serviceName string)

DelPubInfo called when delete publish info received

func DumpConfig

func DumpConfig()

func DumpConfigHandler

func DumpConfigHandler()

DumpConfigHandler should be called in a goroutine we call it in mosn/starter with GoWithRecover, which can handle the panic information

func DumpLock

func DumpLock()

func DumpUnlock

func DumpUnlock()

func GetConfigPath

func GetConfigPath() string

protetced configPath, read only

func GetNetworkFilters

func GetNetworkFilters(c *v2.FilterChain) []types.NetworkFilterChainFactory

GetNetworkFilters returns a network filter factory by filter.Type

func GetStreamFilters

func GetStreamFilters(configs []v2.Filter) []types.StreamFilterChainFactory

GetStreamFilters returns a stream filter factory by filter.Type

func ParseClusterConfig

func ParseClusterConfig(clusters []v2.Cluster) ([]v2.Cluster, map[string][]v2.Host)

ParseClusterConfig parses config data to api data, verify whether the config is valid

func ParseFaultInjectFilter

func ParseFaultInjectFilter(cfg map[string]interface{}) *v2.FaultInject

ParseFaultInjectFilter

func ParseHealthCheckFilter

func ParseHealthCheckFilter(cfg map[string]interface{}) *v2.HealthCheckFilter

ParseHealthCheckFilter

func ParseListenerConfig

func ParseListenerConfig(lc *v2.Listener, inheritListeners []net.Listener) *v2.Listener

ParseListenerConfig

func ParseLogLevel

func ParseLogLevel(level string) log.Level

func ParseMixerFilter

func ParseMixerFilter(cfg map[string]interface{}) *v2.Mixer

ParseMixerFilter

func ParseProxyFilter

func ParseProxyFilter(cfg map[string]interface{}) *v2.Proxy

ParseProxyFilter

func ParseRouterConfiguration

func ParseRouterConfiguration(c *v2.FilterChain) *v2.RouterConfiguration

ParseRouterConfiguration used to get virtualhosts from filter

func ParseServerConfig

func ParseServerConfig(c *v2.ServerConfig) *v2.ServerConfig

ParseServerConfig

func ParseServiceRegistry

func ParseServiceRegistry(src v2.ServiceRegistryInfo)

func ParseStreamFaultInjectFilter

func ParseStreamFaultInjectFilter(cfg map[string]interface{}) (*v2.StreamFaultInject, error)

ParseStreamFaultInjectFilter

func ParseStreamPayloadLimitFilter

func ParseStreamPayloadLimitFilter(cfg map[string]interface{}) (*v2.StreamPayloadLimit, error)

ParseStreamPayloadLimitFilter

func ParseTCPProxy

func ParseTCPProxy(cfg map[string]interface{}) (*v2.TCPProxy, error)

ParseTCPProxy

func RegisterConfigLoadFunc

func RegisterConfigLoadFunc(f ConfigLoadFunc)

RegisterConfigLoadFunc can replace a new config load function instead of default

func RegisterConfigParsedListener

func RegisterConfigParsedListener(key ContentKey, cb ParsedCallback)

RegisterConfigParsedListener used to register ParsedCallback

func RegisterProtocolParser

func RegisterProtocolParser(key string) bool

RegisterProtocolParser used to register parser

func RemoveClusterConfig

func RemoveClusterConfig(clusterNames []string)

func ResetServiceRegistryInfo

func ResetServiceRegistryInfo(appInfo v2.ApplicationInfo, subServiceList []string)

ResetServiceRegistryInfo called when reset service registry info received

func RmMqConsumers

func RmMqConsumers(key string)

RmMqConsumers remove topic consumer list

func SetMqConsumers

func SetMqConsumers(key string, consumers []string)

SetMqConsumers update topic consumer list

func UpdateMqClientKey

func UpdateMqClientKey(id, clientKey string, remove bool)

UpdateMqClientKey update mq client registry info

func UpdateMqMeta

func UpdateMqMeta(topic, meta string, remove bool)

UpdteMqMeta update mq meta info

Types

type ClusterManagerConfig

type ClusterManagerConfig struct {
	ClusterManagerConfigJson
	Clusters []v2.Cluster `json:"-"`
}

ClusterManagerConfig for making up cluster manager Cluster is the global cluster of mosn

func (ClusterManagerConfig) MarshalJSON

func (cc ClusterManagerConfig) MarshalJSON() (b []byte, err error)

Marshal memory config into json, if dynamic mode is configured, write json file

func (*ClusterManagerConfig) UnmarshalJSON

func (cc *ClusterManagerConfig) UnmarshalJSON(b []byte) error

type ClusterManagerConfigJson

type ClusterManagerConfigJson struct {
	// Note: consider to use standard configure
	AutoDiscovery bool `json:"auto_discovery,omitempty"`
	// Note: this is a hack method to realize cluster's  health check which push by registry
	RegistryUseHealthCheck bool         `json:"registry_use_health_check,omitempty"`
	ClusterConfigPath      string       `json:"clusters_configs,omitempty"`
	ClustersJson           []v2.Cluster `json:"clusters,omitempty"`
}

type ConfigLoadFunc

type ConfigLoadFunc func(path string) *MOSNConfig

ConfigLoadFunc parse a input(usually file path) into a mosn config

type ContentKey

type ContentKey string
const (
	ParseCallbackKeyCluster        ContentKey = "clusters"
	ParseCallbackKeyServiceRgtInfo ContentKey = "service_registry"
	ParseCallbackKeyProcessor      ContentKey = "processor"
)

Group of ContentKey notes: configcontentkey equals to the key of config file

type MOSNConfig

type MOSNConfig struct {
	Servers         []v2.ServerConfig      `json:"servers,omitempty"`         //server config
	ClusterManager  ClusterManagerConfig   `json:"cluster_manager,omitempty"` //cluster config
	ServiceRegistry v2.ServiceRegistryInfo `json:"service_registry"`          //service registry config, used by service discovery module
	//tracing config
	Tracing             TracingConfig   `json:"tracing"`
	Metrics             MetricsConfig   `json:"metrics"`
	RawDynamicResources json.RawMessage `json:"dynamic_resources,omitempty"` //dynamic_resources raw message
	RawStaticResources  json.RawMessage `json:"static_resources,omitempty"`  //static_resources raw message
	RawAdmin            json.RawMessage `json:"admin,omitempty"`             // admin raw message
	Debug               PProfConfig     `json:"pprof,omitempty"`
	Pid                 string          `json:"pid,omitempty"` // pid file
}

MOSNConfig make up mosn to start the mosn project Servers contains the listener, filter and so on ClusterManager used to manage the upstream

func DefaultConfigLoad

func DefaultConfigLoad(path string) *MOSNConfig

func Load

func Load(path string) *MOSNConfig

Load config file and parse

func (*MOSNConfig) GetAdmin

func (c *MOSNConfig) GetAdmin() *xdsboot.Admin

func (*MOSNConfig) Mode

func (c *MOSNConfig) Mode() Mode

type MetricsConfig

type MetricsConfig struct {
	SinkConfigs  []v2.Filter       `json:"sinks"`
	StatsMatcher v2.StatsMatcher   `json:"stats_matcher"`
	ShmZone      string            `json:"shm_zone"`
	ShmSize      datasize.ByteSize `json:"shm_size"`
}

MetricsConfig for metrics sinks

type Mode

type Mode uint8

Mode is mosn's starting type

const (
	File Mode = iota
	Xds
	Mix
)

File means start from config file Xds means start from xds Mix means start both from file and Xds

type PProfConfig

type PProfConfig struct {
	StartDebug bool `json:"debug"`      // If StartDebug is true, start a pprof, default is false
	Port       int  `json:"port_value"` // If port value is 0, will use 9090 as default
}

PProfConfig is used to start a pprof server for debug

type ParsedCallback

type ParsedCallback func(data interface{}, endParsing bool) error

ParsedCallback is an alias for closure func(data interface{}, endParsing bool) error

type TracingConfig

type TracingConfig struct {
	Enable bool                   `json:"enable"`
	Tracer string                 `json:"tracer"`
	Driver string                 `json:"driver"`
	Config map[string]interface{} `json:"config,omitempty"`
}

Tracing configuration for a server

Jump to

Keyboard shortcuts

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