apollo

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeListener

type ChangeListener struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*ChangeListener) OnChange

func (l *ChangeListener) OnChange(event *storage.ChangeEvent)

OnChange 增加变更监控

func (*ChangeListener) OnNewestChange

func (l *ChangeListener) OnNewestChange(event *storage.FullChangeEvent)

OnNewestChange 监控最新变更

type Client

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

Client apollo对象

func CreateClient

func CreateClient(conf *Config) (*Client, error)

CreateClient

func DefaultClient

func DefaultClient() *Client

func InitDefaultClient

func InitDefaultClient(conf *Config) (*Client, error)

func (*Client) Get

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

func (*Client) Load

func (c *Client) Load(namespace, key string, loader loader.Loader) error

Load 调用Get并加载配置

func (*Client) Watch

func (c *Client) Watch(namespace, key string, loader loader.Loader, immediately bool) error

Watch 监控key配置 immediately是否先同步获取一次配置 watch后的key允许删除

type Config

type Config struct {
	Addr      string   `json:"addr"` // 要求 http:// 开头
	AppID     string   `json:"appId"`
	Cluster   string   `json:"cluster"`
	NameSpace []string `json:"namespace,omitempty"`
	Secret    string   `json:"secret"`
}

Jump to

Keyboard shortcuts

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