server

package
v0.0.14 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AGENT_CREATE_ERR = errors.New("create agent faile")

Functions

func StartGRPCServer

func StartGRPCServer(grpcPort int, s *AgentServer)

StartGRPCServer 启动GRPC服务端

Types

type AgentServer

type AgentServer struct {
	pubproto.UnimplementedPubConnectServer
	DoWorkChan chan Work // 客户端主动上报消息通道

	RegisterFunDo func(appName, appUuid, secret string) error
	CloserFunDo   func(appName, appUuid string) error
	// contains filtered or unexported fields
}

func NewServer

func NewServer() *AgentServer

NewServer 初始化服务端方法

func (*AgentServer) CloseWatcher added in v0.0.6

func (s *AgentServer) CloseWatcher(uuid string)

AgentServer_CloseWatcher 外部关闭连接

func (*AgentServer) ConnectAfterDo

func (s *AgentServer) ConnectAfterDo(req *pubproto.WorkDetail)

ConnectAfterDo 创建通道后置操作

func (*AgentServer) DoWork

DoWork 流式双向数据通道 服务端GRPC方法,双向通道核心流程 客户端每一次调用该方法将创建一个独立的通信通道sws

func (*AgentServer) GetWatcherFilterItem added in v0.0.11

func (s *AgentServer) GetWatcherFilterItem(appName, filterContent string) (appInfo AppInfo, err error)

GetWatcherItem 获取连接实例带包含过滤

func (*AgentServer) GetWatcherItem

func (s *AgentServer) GetWatcherItem(appName string) (appInfo AppInfo, err error)

GetWatcherItem 获取连接实例

func (*AgentServer) GetWatcherList

func (s *AgentServer) GetWatcherList() (appList []AppInfo)

ConnectAfterDo 创建通道后置操作

func (*AgentServer) GetWorkResult

func (s *AgentServer) GetWorkResult(uuid string) (Work, error)

获取下发操作执行结果

func (*AgentServer) Register

func (s *AgentServer) Register(c context.Context, req *pubproto.RegReq) (*pubproto.RegResp, error)

Register 服务端方法,注册代理节点消息

func (*AgentServer) SendWork

func (s *AgentServer) SendWork(priKey, appName, appUuid, name, params string) (actionUuid string)

SendWork 向客户端发送消息

type AppInfo

type AppInfo struct {
	Name string
	UUID string
}

type Work

type Work struct {
	PriKey       string
	AppName      string // 需要调度的执行器的应用名称
	AppUuid      string
	Name         string // 执行的任务名称
	Uuid         string // 执行任务的uid
	Params       string // 执行任务的参数
	RequestTime  int64  // 提交任务的时间
	ResponseTime int64  // 响应任务的时间
	Status       string // 任务的状态
	Results      string // 查询任务的返回
}

Jump to

Keyboard shortcuts

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