configcenter

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package memberdiscovery created on 2017/6/20.

Index

Constants

View Source
const (

	//StatusUP is a variable of type string
	StatusUP = "UP"
	//HeaderContentType is a variable of type string
	HeaderContentType = "Content-Type"
	//HeaderUserAgent is a variable of type string
	HeaderUserAgent = "User-Agent"
	//HeaderEnvironment specifies the environment of a service
	HeaderEnvironment = "X-Environment"

	// Name of the Plugin
	Name = "config_center"
)

Variables

View Source
var (
	//HeaderTenantName is a variable of type string
	HeaderTenantName = "X-Tenant-Name"
	//ConfigMembersPath is a variable of type string
	ConfigMembersPath = ""
	//ConfigPath is a variable of type string
	ConfigPath = ""
	//ConfigRefreshPath is a variable of type string
	ConfigRefreshPath = ""
	//MemberDiscoveryService is a variable
	MemberDiscoveryService MemberDiscovery
)

Functions

func GetConfigs added in v0.3.0

func GetConfigs(actionData []byte) (map[string]interface{}, error)

GetConfigs get KV from a event

func GetDefaultHeaders

func GetDefaultHeaders(tenantName string) http.Header

GetDefaultHeaders gets default headers

func NewConfigCenter

func NewConfigCenter(options config.Options) config.Client

NewConfigCenter is a function

Types

type Client

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

Client is Client Implementation of Client

func (*Client) DeleteConfigsByKeys

func (cclient *Client) DeleteConfigsByKeys(keys []string, dimensionInfo string) (map[string]interface{}, error)

DeleteConfigsByKeys

func (*Client) PullConfig

func (cclient *Client) PullConfig(serviceName, version, app, env, key, contentType string) (interface{}, error)

PullConfig is the implementation of Client to pull specific configurations from Config-Server

func (*Client) PullConfigs

func (cclient *Client) PullConfigs(serviceName, version, app, env string) (map[string]interface{}, error)

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

func (*Client) PullConfigsByDI

func (cclient *Client) PullConfigsByDI(dimensionInfo, diInfo string) (map[string]map[string]interface{}, error)

PullConfigsByDI pulls the configuration for custom DimensionInfo

func (*Client) PushConfigs

func (cclient *Client) PushConfigs(items map[string]interface{}, dimensionInfo string) (map[string]interface{}, error)

PushConfigs push configs to ConfigSource cc , success will return { "Result": "Success" }

func (*Client) Watch added in v0.3.0

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

type CreateConfigApi added in v0.3.0

type CreateConfigApi struct {
	DimensionInfo string                 `json:"dimensionsInfo"`
	Items         map[string]interface{} `json:"items"`
}

type DeleteConfigApi added in v0.3.0

type DeleteConfigApi struct {
	DimensionInfo string   `json:"dimensionsInfo"`
	Keys          []string `json:"keys"`
}

type Event added in v0.3.0

type Event struct {
	Action string `json:"action"`
	Value  string `json:"value"`
}

ConfigCenterEvent stores info about an config center event

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 MemDiscovery

type MemDiscovery struct {
	ConfigServerAddresses []string
	//Logger                *log.Entry
	IsInit     bool
	TLSConfig  *tls.Config
	TenantName string
	EnableSSL  bool
	sync.RWMutex
	// contains filtered or unexported fields
}

MemDiscovery is a struct

func (*MemDiscovery) ConfigurationInit

func (memDis *MemDiscovery) ConfigurationInit(initConfigServer []string) error

ConfigurationInit is a method for creating a configuration

func (*MemDiscovery) GetConfigServer

func (memDis *MemDiscovery) GetConfigServer() ([]string, error)

GetConfigServer is a method used for getting server configuration

func (*MemDiscovery) GetWorkingConfigCenterIP

func (memDis *MemDiscovery) GetWorkingConfigCenterIP(entryPoint []string) ([]string, error)

GetWorkingConfigCenterIP is a method which gets working configuration center IP

func (*MemDiscovery) HTTPDo

func (memDis *MemDiscovery) HTTPDo(method string, rawURL string, headers http.Header, body []byte) (resp *http.Response, err error)

HTTPDo Use http-client package for rest communication

func (*MemDiscovery) RefreshMembers

func (memDis *MemDiscovery) RefreshMembers() error

RefreshMembers is a method

func (*MemDiscovery) Shuffle

func (memDis *MemDiscovery) Shuffle() error

Shuffle is a method to log error

type MemberDiscovery

type MemberDiscovery interface {
	ConfigurationInit([]string) error
	GetConfigServer() ([]string, error)
	RefreshMembers() error
	Shuffle() error
	GetWorkingConfigCenterIP([]string) ([]string, error)
}

MemberDiscovery is a interface

type Members

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

Members is a struct

Jump to

Keyboard shortcuts

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