apollo

package
v1.8.8 Latest Latest
Warning

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

Go to latest
Published: May 26, 2024 License: MIT Imports: 10 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 Client

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

func New

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

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) (*Configuration, error)

func (*Client) GetDefault

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

func (*Client) GetDefaultConfig

func (c *Client) GetDefaultConfig() (*Configuration, error)

func (*Client) GetNoCacheConfig

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

func (*Client) UpdateConfig

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

type Config

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

func NewConfig

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

func (*Config) NewClient

func (c *Config) NewClient() (*Client, error)

type Configuration

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

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

Jump to

Keyboard shortcuts

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