新增测试模块

This commit is contained in:
boyce
2019-09-23 14:38:44 +08:00
parent 6e1ccc9a36
commit 9623cd2735
11 changed files with 298 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
package main
import (
"github.com/duanhf2012/origin/originnode"
"github.com/duanhf2012/origin/service"
)
type InputData struct {
A1 int
A2 int
}
type SubNet1_Service1 struct {
service.BaseService
}
func init() {
originnode.InitService(&SubNet1_Service1{})
}
//OnInit ...
func (ws *SubNet1_Service1) OnInit() error {
return nil
}
//OnRun ...
func (ws *SubNet1_Service1) OnRun() bool {
return false
}
//服务要对外的接口规划如下:
//RPC_MethodName(arg *DataType1, ret *DataType2) error
//如果不符合规范,在加载服务时,该函数将不会被映射,其他服务将不允能调用。
func (slf *SubNet1_Service1) RPC_Add(arg *InputData, ret *int) error {
*ret = arg.A1 + arg.A2
return nil
}