zhangmeng
2019-12-24 3f19ab3c8cb8b5d0ee4aed32eb58e92519b22f3e
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{})),
   }