client

package
v0.0.0-...-a3dc05e Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {

	//GetConfig get config  by dataId and group
	//if timeout or internal error it return empty string
	GetConfig(dataId, group string, timeout int) string

	//GetConfigAndSetListener get config  by dataId and group
	//if timeout or internal error it return empty string
	//need to implement listener.ManagerListener to receive config changed
	GetConfigAndSetListener(dataId, group string, timeout int, mListener listener.ManagerListener) string

	//PublishConfig publish or update  config by dataId and group
	//if internal error it will return false
	PublishConfig(dataId, group string, content string) bool

	//GetManagerListeners get all listener
	GetManagerListeners() *singlylinkedlist.List

	//SetManagerListener set listener by dataId and group
	SetManagerListener(dataId, group string, mListener listener.ManagerListener)

	//Close release resource
	Close()
}

Client user api

type DefaultClient

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

DefaultClient default client implement Client

func NewClient

func NewClient() *DefaultClient

NewClient new

func (*DefaultClient) Close

func (dm *DefaultClient) Close()

Close implement method

func (*DefaultClient) GetConfig

func (dm *DefaultClient) GetConfig(dataId, group string, timeout int) string

GetConfig get config by dataId and group if timeout or internal error it return empty string config sequence:local file -> server -> snapshot file

func (*DefaultClient) GetConfigAndSetListener

func (dm *DefaultClient) GetConfigAndSetListener(dataId, group string, timeout int, mListener listener.ManagerListener) string

GetConfigAndSetListener get config by dataId and group if timeout or internal error it return empty string need to implement listener.ManagerListener to receive config changed config sequence:local file -> server -> snapshot file

func (*DefaultClient) GetManagerListeners

func (dm *DefaultClient) GetManagerListeners() *singlylinkedlist.List

GetManagerListeners implement method

func (*DefaultClient) PublishConfig

func (dm *DefaultClient) PublishConfig(dataId, group string, content string) bool

PublishConfig publish config info to server

func (*DefaultClient) SetManagerListener

func (dm *DefaultClient) SetManagerListener(dataId, group string, mListener listener.ManagerListener)

SetManagerListener implement method

Jump to

Keyboard shortcuts

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