configcenter

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

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

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() (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)) 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

type Source struct {
	sync.RWMutex

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

Source handles configs from config center.

func (*Source) AddDimensionInfo

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

AddDimensionInfo adds dimension info for a configuration.

func (*Source) Cleanup

func (rs *Source) Cleanup() error

Cleanup cleans the particular configuration up.

func (*Source) Delete

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

Delete no use.

func (*Source) GetConfigurationByKey

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

GetConfigurationByKey gets required configuration for a particular key.

func (*Source) GetConfigurations

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

func (rs *Source) GetPriority() int

GetPriority returns priority of a configuration.

func (*Source) GetSourceName

func (*Source) GetSourceName() string

GetSourceName returns name of the configuration.

func (*Source) Set

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

Set no use.

func (*Source) SetPriority

func (rs *Source) SetPriority(priority int)

SetPriority custom priority.

func (*Source) Watch

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