3 Star 2 Fork 0

info-superbahn-ict / superbahn

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
client.go 1.11 KB
一键复制 编辑 原始数据 按行查看 历史
tangshibo 提交于 2021-11-19 12:29 . 11-19
package main
import (
"context"
"gitee.com/info-superbahn-ict/superbahn/pkg/plugins"
"gitee.com/info-superbahn-ict/superbahn/pkg/supbagent/apis"
"gitee.com/info-superbahn-ict/superbahn/sync/define"
"github.com/sirupsen/logrus"
)
func PluginsName() string {
return "agent.nervous.resources.cli"
}
func NewPlugin(ctx context.Context, p *apis.Manager) (plugins.PluginFactory, error) {
return &NervousClientPlugin{
ctx: ctx,
api: p,
}, nil
}
type NervousClientPlugin struct {
ctx context.Context
api *apis.Manager
}
func (r *NervousClientPlugin) Run() {
log := logrus.WithContext(r.ctx).WithFields(logrus.Fields{
define.LogsPrintCommonLabelOfFunction: "agent.plugin.resource.cli",
})
go func() {
if err := r.syncFuncMap();err !=nil {
log.Errorf("sync function map %v",err)
}
log.Infof("sync func map finished")
}()
name := PluginsName()
log.Infof("plugins %v initialization complete", name)
<-r.ctx.Done()
log.Infof("plugins %v closed", name)
}
func (r *NervousClientPlugin) Close() {
}
func (r *NervousClientPlugin) Call(f string, args ...interface{}) (interface{}, error) {
return nil, nil
}
Go
1
https://gitee.com/info-superbahn-ict/superbahn.git
git@gitee.com:info-superbahn-ict/superbahn.git
info-superbahn-ict
superbahn
superbahn
5fda629dab96

搜索帮助