registry

package
v0.0.0-...-f49aa48 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

README

介绍

与 registry 的交互.
内置了CA证书.

Documentation

Index

Constants

View Source
const (
	CodeOk int32 = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentInfo

type AgentInfo struct {
	AgentId      string
	App          string
	AgentVersion string
	Ip           string
	Hostname     string
	OS           string
	Arch         string
	Labels       map[string]string
	K8s          *pb2.AgentK8SInfo
	Mode         string
	Workspace    string
}

type Config

type Config struct {
	// grpc 的 ip:port
	Addr string
	// 是否启动ssl
	Secure bool
	// ca证书
	CaCert             string
	CaCertBase64       string
	ServerName         string
	Apikey             string
	CompressionEnabled bool
	AgentId            string
	Workspace          string
}

registry 相关的配置

type HandlerRegistry

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

func NewHandlerRegistry

func NewHandlerRegistry() *HandlerRegistry

func (*HandlerRegistry) GetHandshakeHandler

func (r *HandlerRegistry) GetHandshakeHandler() HandshakeHandler

func (*HandlerRegistry) GetOneway

func (r *HandlerRegistry) GetOneway(bizType int32) OnewayHandler

func (*HandlerRegistry) GetRpc

func (r *HandlerRegistry) GetRpc(bizType int32) RpcHandler

func (*HandlerRegistry) RegisterHandshake

func (r *HandlerRegistry) RegisterHandshake(h HandshakeHandler)

func (*HandlerRegistry) RegisterOneway

func (r *HandlerRegistry) RegisterOneway(bizType int32, h OnewayHandler)

func (*HandlerRegistry) RegisterRpc

func (r *HandlerRegistry) RegisterRpc(bizType int32, h RpcHandler)

type HandshakeHandler

type HandshakeHandler func(ctx context.Context, c pb.RegistryServiceForAgent_BiStreamsClient, version int64) error

type OnewayHandler

type OnewayHandler func(int32, []byte)

type ReconnectListener

type ReconnectListener interface {
	OnReconnect()
}

type RpcHandler

type RpcHandler func(int32, []byte) (int32, interface{}, error)

type Service

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

registry 服务

func New

func New(config Config) (*Service, error)

func (*Service) BiStream

BiStream 双向流

func (*Service) GetCollectTasks

func (s *Service) GetCollectTasks(ctx context.Context, agentId string, buckets map[string]string) (*pb2.GetCollectTasksResponse, error)

GetCollectTasks 查询所有的采集配置

func (*Service) GetControlConfigs

func (s *Service) GetControlConfigs(ctx context.Context, agentId string) (*pb2.GetControlConfigsResponse, error)

GetControlConfigs 查控制参数 TODO 我们要定义控制参数的模型, 转换后返回给用户, 而不是直接返回pb的结果给用户(虽然这样方便一点)

func (*Service) GetLastControlConfigs

func (s *Service) GetLastControlConfigs() *pb2.GetControlConfigsResponse

func (*Service) ListenReconnect

func (s *Service) ListenReconnect(listener ReconnectListener)

func (*Service) MetaDeltaSync

func (s *Service) MetaDeltaSync(request *pb2.MetaSync_DeltaSyncRequest) error

func (*Service) MetaFullSync

func (s *Service) MetaFullSync(request *pb2.MetaSync_FullSyncRequest) error

func (*Service) Ping

func (s *Service) Ping(ctx context.Context) error

Ping ping一下

func (*Service) RegisterAgent

func (s *Service) RegisterAgent(ctx context.Context, agentInfo AgentInfo) (*pb2.RegisterAgentResponse, error)

RegisterAgent 注册agent

func (*Service) RemoveReconnect

func (s *Service) RemoveReconnect(listener ReconnectListener)

func (*Service) ReportEventAsync

func (s *Service) ReportEventAsync(events ...*pb2.ReportEventRequest_Event)

func (*Service) ReportRunEvents

func (s *Service) ReportRunEvents(ctx context.Context, agentId string, events []*eventcollector.Event) (*pb2.RunEventsResponse, error)

func (*Service) ReportRunStats

func (s *Service) ReportRunStats(ctx context.Context, agentId string, ts int64,
	agentRunStats map[string]uint64, collectConfigRunStats []*pb2.CollectConfigRunStats) (*pb2.RunStatsResponse, error)

上报运行状况统计

func (*Service) SendHeartBeat

func (s *Service) SendHeartBeat(ctx context.Context, agentId string) (*pb2.SendAgentHeartbeatResponse, error)

SendHeartBeat 发送心跳

func (*Service) Stop

func (s *Service) Stop()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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