Documentation ¶
Overview ¶
Package basemodule 模块管理
Package basemodule 模块管理器 ¶
Package basemodule 服务节点实例定义 ¶
Package basemodule BaseModule定义
Index ¶
- func NewServerSession(app module.App, name string, node *registry.Node) (module.ServerSession, error)
- type BaseModule
- func (m *BaseModule) BeforeHandle(fn string, callInfo *mqrpc.CallInfo) error
- func (m *BaseModule) Call(ctx context.Context, moduleType, _func string, param mqrpc.ParamOption, ...) (interface{}, string)
- func (m *BaseModule) GetApp() module.App
- func (m *BaseModule) GetExecuting() int64
- func (m *BaseModule) GetModuleSettings() *conf.ModuleSettings
- func (m *BaseModule) GetRouteServer(moduleType string, opts ...selector.SelectOption) (s module.ServerSession, err error)
- func (m *BaseModule) GetServer() server.Server
- func (m *BaseModule) GetServerID() string
- func (m *BaseModule) GetServerId() string
- func (m *BaseModule) GetSubclass() module.RPCModule
- func (m *BaseModule) Invoke(moduleType string, _func string, params ...interface{}) (result interface{}, err string)
- func (m *BaseModule) InvokeArgs(moduleType string, _func string, ArgsType []string, args [][]byte) (result interface{}, err string)
- func (m *BaseModule) InvokeNR(moduleType string, _func string, params ...interface{}) (err error)
- func (m *BaseModule) InvokeNRArgs(moduleType string, _func string, ArgsType []string, args [][]byte) (err error)
- func (m *BaseModule) NoFoundFunction(fn string) (*mqrpc.FunctionInfo, error)
- func (m *BaseModule) OnAppConfigurationLoaded(app module.App)
- func (m *BaseModule) OnComplete(fn string, callInfo *mqrpc.CallInfo, result *rpcpb.ResultInfo, execTime int64)
- func (m *BaseModule) OnConfChanged(settings *conf.ModuleSettings)
- func (m *BaseModule) OnDestroy()
- func (m *BaseModule) OnError(fn string, callInfo *mqrpc.CallInfo, err error)
- func (m *BaseModule) OnInit(subclass module.RPCModule, app module.App, settings *conf.ModuleSettings, ...)
- func (m *BaseModule) OnTimeOut(fn string, Expired int64)
- func (m *BaseModule) RpcCall(ctx context.Context, moduleType, _func string, param mqrpc.ParamOption, ...) (interface{}, string)
- func (m *BaseModule) RpcInvoke(moduleType string, _func string, params ...interface{}) (result interface{}, err string)
- func (m *BaseModule) RpcInvokeArgs(moduleType string, _func string, ArgsType []string, args [][]byte) (result interface{}, err string)
- func (m *BaseModule) RpcInvokeNR(moduleType string, _func string, params ...interface{}) (err error)
- func (m *BaseModule) RpcInvokeNRArgs(moduleType string, _func string, ArgsType []string, args [][]byte) (err error)
- func (m *BaseModule) SetListener(listener mqrpc.RPCListener)
- type DefaultModule
- type ModuleManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewServerSession ¶
func NewServerSession(app module.App, name string, node *registry.Node) (module.ServerSession, error)
NewServerSession 创建一个节点实例
Types ¶
type BaseModule ¶
BaseModule 默认的RPCModule实现
func (*BaseModule) BeforeHandle ¶
func (m *BaseModule) BeforeHandle(fn string, callInfo *mqrpc.CallInfo) error
BeforeHandle hander执行前调用
func (*BaseModule) Call ¶
func (m *BaseModule) Call(ctx context.Context, moduleType, _func string, param mqrpc.ParamOption, opts ...selector.SelectOption) (interface{}, string)
Call Call
func (*BaseModule) GetExecuting ¶
func (m *BaseModule) GetExecuting() int64
GetExecuting GetExecuting
func (*BaseModule) GetModuleSettings ¶
func (m *BaseModule) GetModuleSettings() *conf.ModuleSettings
GetModuleSettings GetModuleSettings
func (*BaseModule) GetRouteServer ¶
func (m *BaseModule) GetRouteServer(moduleType string, opts ...selector.SelectOption) (s module.ServerSession, err error)
GetRouteServer GetRouteServer
func (*BaseModule) GetServer ¶
func (m *BaseModule) GetServer() server.Server
GetServer server.Server
func (*BaseModule) GetServerId ¶
func (m *BaseModule) GetServerId() string
GetServerId GetServerId Deprecated: 因为命名规范问题函数将废弃,请用GetServerID代替
func (*BaseModule) Invoke ¶
func (m *BaseModule) Invoke(moduleType string, _func string, params ...interface{}) (result interface{}, err string)
Invoke Invoke
func (*BaseModule) InvokeArgs ¶
func (m *BaseModule) InvokeArgs(moduleType string, _func string, ArgsType []string, args [][]byte) (result interface{}, err string)
InvokeArgs InvokeArgs
func (*BaseModule) InvokeNR ¶
func (m *BaseModule) InvokeNR(moduleType string, _func string, params ...interface{}) (err error)
InvokeNR InvokeNR
func (*BaseModule) InvokeNRArgs ¶
func (m *BaseModule) InvokeNRArgs(moduleType string, _func string, ArgsType []string, args [][]byte) (err error)
InvokeNRArgs InvokeNRArgs
func (*BaseModule) NoFoundFunction ¶
func (m *BaseModule) NoFoundFunction(fn string) (*mqrpc.FunctionInfo, error)
NoFoundFunction 当hander未找到时调用
func (*BaseModule) OnAppConfigurationLoaded ¶
func (m *BaseModule) OnAppConfigurationLoaded(app module.App)
OnAppConfigurationLoaded 当应用配置加载完成时调用
func (*BaseModule) OnComplete ¶
func (m *BaseModule) OnComplete(fn string, callInfo *mqrpc.CallInfo, result *rpcpb.ResultInfo, execTime int64)
OnComplete hander成功执行完成时调用 fn 方法名 params 参数 result 执行结果 exec_time 方法执行时间 单位为 Nano 纳秒 1000000纳秒等于1毫秒
func (*BaseModule) OnConfChanged ¶
func (m *BaseModule) OnConfChanged(settings *conf.ModuleSettings)
OnConfChanged 当配置变更时调用
func (*BaseModule) OnError ¶
func (m *BaseModule) OnError(fn string, callInfo *mqrpc.CallInfo, err error)
OnError hander执行错误调用
func (*BaseModule) OnInit ¶
func (m *BaseModule) OnInit(subclass module.RPCModule, app module.App, settings *conf.ModuleSettings, opt ...server.Option)
OnInit 当模块初始化时调用
func (*BaseModule) OnTimeOut ¶
func (m *BaseModule) OnTimeOut(fn string, Expired int64)
OnTimeOut hander执行超时调用
func (*BaseModule) RpcCall ¶
func (m *BaseModule) RpcCall(ctx context.Context, moduleType, _func string, param mqrpc.ParamOption, opts ...selector.SelectOption) (interface{}, string)
RpcCall RpcCall Deprecated: 因为命名规范问题函数将废弃,请用Call代替
func (*BaseModule) RpcInvoke ¶
func (m *BaseModule) RpcInvoke(moduleType string, _func string, params ...interface{}) (result interface{}, err string)
RpcInvoke RpcInvoke Deprecated: 因为命名规范问题函数将废弃,请用Invoke代替
func (*BaseModule) RpcInvokeArgs ¶
func (m *BaseModule) RpcInvokeArgs(moduleType string, _func string, ArgsType []string, args [][]byte) (result interface{}, err string)
RpcInvokeArgs RpcInvokeArgs Deprecated: 因为命名规范问题函数将废弃,请用RpcInvokeArgs代替
func (*BaseModule) RpcInvokeNR ¶
func (m *BaseModule) RpcInvokeNR(moduleType string, _func string, params ...interface{}) (err error)
RpcInvokeNR RpcInvokeNR Deprecated: 因为命名规范问题函数将废弃,请用InvokeNR代替
func (*BaseModule) RpcInvokeNRArgs ¶
func (m *BaseModule) RpcInvokeNRArgs(moduleType string, _func string, ArgsType []string, args [][]byte) (err error)
RpcInvokeNRArgs RpcInvokeNRArgs Deprecated: 因为命名规范问题函数将废弃,请用InvokeNRArgs代替
func (*BaseModule) SetListener ¶
func (m *BaseModule) SetListener(listener mqrpc.RPCListener)
SetListener mqrpc.RPCListener
type DefaultModule ¶
type DefaultModule struct {
// contains filtered or unexported fields
}
DefaultModule 模块结构
type ModuleManager ¶
type ModuleManager struct {
// contains filtered or unexported fields
}
ModuleManager 模块管理器
func (*ModuleManager) CheckModuleSettings ¶
func (mer *ModuleManager) CheckModuleSettings()
CheckModuleSettings module配置文件规则检查 ID全局必须唯一 每一个类型的Module列表中ProcessID不能重复
func (*ModuleManager) Init ¶
func (mer *ModuleManager) Init(app module.App, ProcessID string)
Init 初始化
func (*ModuleManager) RegisterRunMod ¶
func (mer *ModuleManager) RegisterRunMod(mi module.Module)
RegisterRunMod 注册需要运行的模块