basemodule

package
v1.1.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2019 License: Apache-2.0 Imports: 20 Imported by: 47

Documentation

Overview

Copyright 2014 loolgame Author. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2014 loolgame Author. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2014 loolgame Author. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2014 mqantserver Author. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2014 mqant Author. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadStatisticalMethod

func LoadStatisticalMethod(j string) map[string]*StatisticalMethod

func NewServerSession

func NewServerSession(app module.App, name string, node *registry.Node) (module.ServerSession, error)

Types

type BaseModule

type BaseModule struct {
	context.Context

	App module.App
	// contains filtered or unexported fields
}

func (*BaseModule) BeforeHandle

func (m *BaseModule) BeforeHandle(fn string, callInfo *mqrpc.CallInfo) error

func (*BaseModule) GetApp

func (m *BaseModule) GetApp() module.App

func (*BaseModule) GetExecuting

func (m *BaseModule) GetExecuting() int64

func (*BaseModule) GetModuleSettings

func (m *BaseModule) GetModuleSettings() *conf.ModuleSettings

func (*BaseModule) GetRouteServer

func (m *BaseModule) GetRouteServer(moduleType string, opts ...selector.SelectOption) (s module.ServerSession, err error)

func (*BaseModule) GetServer

func (m *BaseModule) GetServer() server.Server

func (*BaseModule) GetServerId

func (m *BaseModule) GetServerId() string

func (*BaseModule) GetStatistical

func (m *BaseModule) GetStatistical() (statistical string, err error)

func (*BaseModule) GetSubclass

func (m *BaseModule) GetSubclass() module.RPCModule

func (*BaseModule) NoFoundFunction

func (m *BaseModule) NoFoundFunction(fn string) (*mqrpc.FunctionInfo, error)

func (*BaseModule) OnAppConfigurationLoaded

func (m *BaseModule) OnAppConfigurationLoaded(app module.App)

func (*BaseModule) OnComplete

func (m *BaseModule) OnComplete(fn string, callInfo *mqrpc.CallInfo, result *rpcpb.ResultInfo, exec_time int64)

* fn 方法名 params 参数 result 执行结果 exec_time 方法执行时间 单位为 Nano 纳秒 1000000纳秒等于1毫秒

func (*BaseModule) OnConfChanged

func (m *BaseModule) OnConfChanged(settings *conf.ModuleSettings)

func (*BaseModule) OnDestroy

func (m *BaseModule) OnDestroy()

func (*BaseModule) OnError

func (m *BaseModule) OnError(fn string, callInfo *mqrpc.CallInfo, err error)

func (*BaseModule) OnInit

func (m *BaseModule) OnInit(subclass module.RPCModule, app module.App, settings *conf.ModuleSettings, opt ...server.Option)

func (*BaseModule) OnTimeOut

func (m *BaseModule) OnTimeOut(fn string, Expired int64)

func (*BaseModule) RpcCall

func (m *BaseModule) RpcCall(ctx context.Context, moduleType, _func string, param mqrpc.ParamOption, opts ...selector.SelectOption) (interface{}, string)

func (*BaseModule) RpcInvoke

func (m *BaseModule) RpcInvoke(moduleType string, _func string, params ...interface{}) (result interface{}, err string)

func (*BaseModule) RpcInvokeArgs

func (m *BaseModule) RpcInvokeArgs(moduleType string, _func string, ArgsType []string, args [][]byte) (result interface{}, err string)

func (*BaseModule) RpcInvokeNR

func (m *BaseModule) RpcInvokeNR(moduleType string, _func string, params ...interface{}) (err error)

func (*BaseModule) RpcInvokeNRArgs

func (m *BaseModule) RpcInvokeNRArgs(moduleType string, _func string, ArgsType []string, args [][]byte) (err error)

func (*BaseModule) SetListener

func (m *BaseModule) SetListener(listener mqrpc.RPCListener)

type DefaultModule

type DefaultModule struct {
	// contains filtered or unexported fields
}

type ModuleManager

type ModuleManager struct {
	// contains filtered or unexported fields
}

func NewModuleManager

func NewModuleManager() (m *ModuleManager)

func (*ModuleManager) CheckModuleSettings

func (mer *ModuleManager) CheckModuleSettings()

* module配置文件规则检查 1. ID全局必须唯一 2. 每一个类型的Module列表中ProcessID不能重复

func (*ModuleManager) Destroy

func (mer *ModuleManager) Destroy()

func (*ModuleManager) Init

func (mer *ModuleManager) Init(app module.App, ProcessID string)

func (*ModuleManager) Register

func (mer *ModuleManager) Register(mi module.Module)

func (*ModuleManager) RegisterRunMod

func (mer *ModuleManager) RegisterRunMod(mi module.Module)

type StatisticalMethod

type StatisticalMethod struct {
	Name        string //方法名
	StartTime   int64  //开始时间
	EndTime     int64  //结束时间
	MinExecTime int64  //最短执行时间
	MaxExecTime int64  //最长执行时间
	ExecTotal   int    //执行总次数
	ExecTimeout int    //执行超时次数
	ExecSuccess int    //执行成功次数
	ExecFailure int    //执行错误次数
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL