kie

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: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//Name is the source name of kie.
	Name = "KieSource"
)

const.

Variables

View Source
var DimensionPrecedence = []DimensionName{
	DimensionApp,
	DimensionService,
}

Priority of dimension in DimensionPrecedence array must from low to high.

Functions

func GenerateLabels

func GenerateLabels(dimension DimensionName, optionsLabels map[string]string) (map[string]string, error)

GenerateLabels generate labels to an specific dimensions.

func NewKieSource

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

NewKieSource initializes all components of ServiceComb-Kie.

Types

type Dimension

type Dimension struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Dimension contains a label combination and the configuration corresponding to this label combination.

type DimensionName

type DimensionName string

DimensionName is the name identifying various dimension of configurations. One dimension corresponds to one label combination.

const (
	DimensionApp     DimensionName = "app"
	DimensionService DimensionName = "service"
)

const.

type Kie

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

Kie is Implementation.

func NewKie

func NewKie(options remote.Options) (*Kie, error)

NewKie is a return a new kie client.

func (*Kie) MergeConfig added in v0.0.8

func (k *Kie) MergeConfig() map[string]interface{}

func (*Kie) Options

func (k *Kie) Options() remote.Options

Options return options.

func (*Kie) PullConfigs

func (k *Kie) PullConfigs() (map[string]interface{}, error)

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

func (*Kie) SetDimensionConfigs added in v0.0.8

func (k *Kie) SetDimensionConfigs(kvs *client.KVResponse, dimension DimensionName) bool

func (*Kie) Watch

func (k *Kie) Watch(f func(map[string]interface{}), errHandler func(err error)) error

Watch watch the configuration changes and update in real time.

type Source

type Source struct {
	sync.RWMutex

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

Source handles configs from ServiceComb-Kie.

func (*Source) AddDimensionInfo

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

AddDimensionInfo adds dimension info for a configuration.

func (*Source) Cleanup

func (ks *Source) Cleanup() error

Cleanup cleans the particular configuration up.

func (*Source) Delete

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

Delete no use.

func (*Source) GetConfigurationByKey

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

GetConfigurationByKey gets required configuration for a particular key.

func (*Source) GetConfigurations

func (ks *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 (ks *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 (ks *Source) Set(_ string, _ interface{}) error

Set no use.

func (*Source) SetPriority

func (ks *Source) SetPriority(priority int)

SetPriority custom priority.

func (*Source) Watch

func (ks *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