apollo

package
v0.0.0-...-1f4ee57 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GetConfigUrl     = "http://%s/configfiles/json/%s/%s/%s"
	NoCacheUrl       = "http://%s/configs/%s/%s/%s"
	NotificationsUrl = "http://%s/notifications/v2?appId=%s&cluster=%s"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Apollo

type Apollo struct {
	AppId          string            `json:"appId"`
	Cluster        string            `json:"cluster"`
	NamespaceName  string            `json:"namespaceName"`
	Configurations map[string]string `json:"configurations"`
	ReleaseKey     string            `json:"releaseKey"`
}

type Client

type Client struct {
	Addr          string
	AppId         string `json:"appId"`
	Cluster       string `json:"cluster"`
	IP            string `json:"ip"`
	SpecialConfig SpecialConfig
	//一个应用的appId和集群应该是启动时确定的,但却可以有多个namespace
	Configurations map[string]*Apollo
	Notifications  NotificationMap
	// contains filtered or unexported fields
}

func New

func New(addr, appId, cluster, ip string, namespaces []string, initConfig SpecialConfig) *Client

func (*Client) Close

func (c *Client) Close() error

func (*Client) Get

func (c *Client) Get(namespace, key string) string

func (*Client) GetCacheConfig

func (c *Client) GetCacheConfig(namespace string) error

func (*Client) GetDefault

func (c *Client) GetDefault(key string) string

func (*Client) GetNoCacheConfig

func (c *Client) GetNoCacheConfig(namespace string) error

func (*Client) UpdateConfig

func (c *Client) UpdateConfig(appId, clusterName string) error

type Config

type Config struct {
	Addr    string
	AppId   string `json:"appId"`
	Cluster string `json:"cluster"`
	IP      string `json:"ip"`
}

func NewConfig

func NewConfig(addr, appId, cluster, ip string) *Config

func (*Config) GetInitConfig

func (c *Config) GetInitConfig(namespace string) (map[string]string, error)

type NoChangeError

type NoChangeError struct{}

func (*NoChangeError) Error

func (e *NoChangeError) Error() string

type NotificationInfo

type NotificationInfo struct {
	NamespaceName  string `json:"namespaceName"`
	NotificationId int    `json:"notificationId"`
}

type NotificationMap

type NotificationMap map[string]int

func (NotificationMap) ToSlice

func (nm NotificationMap) ToSlice() NotificationSlice

func (NotificationMap) Update

func (nm NotificationMap) Update(ns []NotificationInfo)

type NotificationSlice

type NotificationSlice []NotificationInfo

func (*NotificationSlice) Add

func (ns *NotificationSlice) Add(nameSpace string)

func (NotificationSlice) ToMap

type SpecialConfig

type SpecialConfig struct {
	NameSpace string
	Callback  func(map[string]string)
}

Jump to

Keyboard shortcuts

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