client

package
v0.0.0-...-982fff5 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2022 License: AFL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DelAgent

func DelAgent()

func RefreshAgentState

func RefreshAgentState(pause bool)

把Agent状态更新到etcd服务器

func Register

func Register() error

Register 注册到ReportServer并获取Uid,设置成全局变量

func RequestToServer

func RequestToServer(req pb.ReportReq) (*pb.ReportRsp, error)

RequestToServer 封装处理pb的Report函数

Types

type ConfigChangeExecuter

type ConfigChangeExecuter interface {
	Execute(wg *sync.WaitGroup) error //配置变化时,执行的处理接口
}

type Etcd

type Etcd struct {
	ConfigServer string   `json:"config_server"`
	AgentGroup   string   `json:"agent_group"`
	AgentName    string   `json:"agent_name"`
	Apply        bool     `json:"apply"`
	EndPoints    []string `json:"end_points"`
	DialTimeout  int      `json:"dial_timeout"`
}

func (*Etcd) CheckConfigServer

func (e *Etcd) CheckConfigServer()

检查etcd上是否正常连接,且不存在同名Agent

func (*Etcd) CloseConn

func (e *Etcd) CloseConn()

func (*Etcd) Connect

func (e *Etcd) Connect() error

func (*Etcd) Execute

func (e *Etcd) Execute(wg *sync.WaitGroup) error

更新配置后执行:重新连接etcd

func (*Etcd) WatchConfig

func (e *Etcd) WatchConfig(configName string, configs interface{}, obj ConfigChangeExecuter, wg *sync.WaitGroup)

WatchConfig 参数 ConfigChangeExecuter表示该配置更新是否要执行事件,nil表示不用

type ReportServer

type ReportServer struct {
	CheckAlive int    `json:"check_alive"` //给ReportServer的检查本agent存活的时间阈值
	Ip         string `json:"ip"`
	Port       string `json:"port"`
}

func (*ReportServer) CloseConn

func (r *ReportServer) CloseConn()

func (*ReportServer) ConnectGRPC

func (r *ReportServer) ConnectGRPC() error

func (*ReportServer) Execute

func (r *ReportServer) Execute(wg *sync.WaitGroup) error

Execute 更新配置后执行:重新连接ReportServer并注册

func (*ReportServer) GetAddr

func (r *ReportServer) GetAddr() string

Jump to

Keyboard shortcuts

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