zhangmeng
2019-12-24 3f19ab3c8cb8b5d0ee4aed32eb58e92519b22f3e
update
2个文件已修改
12 ■■■■■ 已修改文件
app/slave/sdkLoad.go 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/slave/slave.go 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/slave/sdkLoad.go
@@ -10,12 +10,14 @@
// func Create(config string, typ, id string, gpu int, shm bool, ipc2Rule string, ruleMaxSize int, fn func(...interface{}), reserved map[string]string) interface{}
// func Run(ctx context.Context, i interface{}) {
type sdk struct {
// SDK plugin Func
type SDK struct {
    fnCreate func(string, string, string, int, bool, string, int, func(...interface{}), map[string]interface{}) interface{}
    fnRun    func(context.Context, interface{})
}
func loadSDK(soFile string) *sdk {
// LoadSDK from plugin
func LoadSDK(soFile string) *SDK {
    plug, err := plugin.Open(soFile)
    if err != nil {
        logo.Errorln("Slave Open so File: ", soFile, " Error: ", err)
@@ -33,7 +35,7 @@
        logo.Errorln("Load Func Run From: ", soFile, " Error: ", err)
        return nil
    }
    return &sdk{
    return &SDK{
        fnCreate: fnC.(func(string, string, string, int, bool, string, int, func(...interface{}), map[string]interface{}) interface{}),
        fnRun:    fnR.(func(context.Context, interface{})),
    }
app/slave/slave.go
@@ -17,7 +17,7 @@
        logo.Errorln("Slave Read Config Error: ", err)
        return false
    }
    sdk := loadSDK(cfg.SoFile)
    sdk := LoadSDK(cfg.SoFile)
    if sdk == nil {
    }
@@ -36,7 +36,7 @@
        logo.Errorln("Slave Read Config Error: ", err)
        return false
    }
    sdk := loadSDK(cfg.SoFile)
    sdk := LoadSDK(cfg.SoFile)
    if sdk == nil {
        return false
    }