configcenter

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2021 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const (
	//HeaderContentType is a variable of type string
	HeaderContentType = "Content-Type"
	//HeaderUserAgent is a variable of type string
	HeaderUserAgent = "User-Agent"
)
View Source
const (
	//ConfigCenterSourceName variable of type string
	ConfigCenterSourceName = "ConfigCenterSource"
)

const

Variables

This section is empty.

Functions

func GenerateDimension

func GenerateDimension(serviceName, version, appName string) (string, error)

GenerateDimension create config center dimension string

func NewConfigCenterSource added in v1.2.1

func NewConfigCenterSource(ci *archaius.RemoteInfo) (source.ConfigSource, error)

NewConfigCenterSource initializes all components of configuration center

Types

type ConfigCenter

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

ConfigCenter is Implementation

func NewConfigCenter

func NewConfigCenter(options remote.Options) (*ConfigCenter, error)

NewConfigCenter is a function

func (*ConfigCenter) Options

func (c *ConfigCenter) Options() remote.Options

Options return options

func (*ConfigCenter) PullConfigs

func (c *ConfigCenter) PullConfigs(labels ...map[string]string) (map[string]interface{}, error)

PullConfigs is the implementation of ConfigCenter to pull all the configurations from Config-Server

func (*ConfigCenter) Watch

func (c *ConfigCenter) Watch(f func(map[string]interface{}), errHandler func(err error), labels map[string]string) error

Watch use ws

type Instance

type Instance struct {
	Status      string   `json:"status"`
	ServiceName string   `json:"serviceName"`
	IsHTTPS     bool     `json:"isHttps"`
	EntryPoints []string `json:"endpoints"`
}

Instance is a struct

type Members

type Members struct {
	Instances []Instance `json:"instances"`
}

Members is a struct

type Source added in v1.2.1

type Source struct {
	sync.RWMutex

	RefreshMode     int
	RefreshInterval time.Duration
	// contains filtered or unexported fields
}

Source handles configs from config center

func (*Source) AddDimensionInfo added in v1.2.1

func (rs *Source) AddDimensionInfo(labels map[string]string) error

AddDimensionInfo adds dimension info for a configuration

func (*Source) Cleanup added in v1.2.1

func (rs *Source) Cleanup() error

Cleanup cleans the particular configuration up

func (*Source) Delete added in v1.2.1

func (rs *Source) Delete(key string) error

Delete no use

func (*Source) GetConfigurationByKey added in v1.2.1

func (rs *Source) GetConfigurationByKey(key string) (interface{}, error)

GetConfigurationByKey gets required configuration for a particular key

func (*Source) GetConfigurations added in v1.2.1

func (rs *Source) GetConfigurations() (map[string]interface{}, error)

GetConfigurations pull config from remote and start refresh configs interval write a new map and return, internal map can not be operated outside struct

func (*Source) GetPriority added in v1.2.1

func (rs *Source) GetPriority() int

GetPriority returns priority of a configuration

func (*Source) GetSourceName added in v1.2.1

func (*Source) GetSourceName() string

GetSourceName returns name of the configuration

func (*Source) Set added in v1.2.1

func (rs *Source) Set(key string, value interface{}) error

Set no use

func (*Source) SetPriority added in v1.2.1

func (rs *Source) SetPriority(priority int)

SetPriority custom priority

func (*Source) Watch added in v1.2.1

func (rs *Source) Watch(callback source.EventHandler) error

Watch dynamically handles a configuration

Jump to

Keyboard shortcuts

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