remote

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2019 License: Apache-2.0 Imports: 8 Imported by: 5

Documentation

Overview

Package remote created on 2017/6/22.

Index

Constants

View Source
const (
	//Name variable of type string
	Name = "ConfigCenterSource"

	ModeInterval = 1
)

const

Variables

This section is empty.

Functions

func NewConfigCenterSource

func NewConfigCenterSource(cc config.Client, refreshMode, refreshInterval int) source.ConfigSource

NewConfigCenterSource initializes all components of configuration center

Types

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(key 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(key string, value 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