basemodule

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: May 24, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ServiceNotFound = ModuleErr{ID: 001, Name: "service not found", Err: errors.New("service not found")}
)

Functions

func NewServerSession

func NewServerSession(app module.App, name string, s *registry.Service) (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) CheckHeartbeat

func (m *BaseModule) CheckHeartbeat(typeName string)

檢查在線列表心跳

func (*BaseModule) Finish

func (m *BaseModule) Finish(num int)

Finish pop chan when routine finish

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) GetRandomServerByType

func (m *BaseModule) GetRandomServerByType(typeName string) (s module.ServerSession, err error)

func (*BaseModule) GetRandomServiceID

func (m *BaseModule) GetRandomServiceID(typeName string) (result string, err error)

GetRandomServiceID 取得隨機 module ID

func (*BaseModule) GetServer

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

func (*BaseModule) GetServerID

func (m *BaseModule) GetServerID() string

func (*BaseModule) GetServersByType

func (m *BaseModule) GetServersByType(typeName string) (s []module.ServerSession, err error)

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)

當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) RpcInvoke

func (m *BaseModule) RpcInvoke(moduleType string, rpcInvokeResult *mqrpc.ResultInvokeST, ctx ...context.Context) (result interface{}, err string)

func (*BaseModule) RpcInvokeNR

func (m *BaseModule) RpcInvokeNR(moduleType string, rpcInvokeResult *mqrpc.ResultInvokeST) (err error)

func (*BaseModule) SetListener

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

func (*BaseModule) Start

func (m *BaseModule) Start(num int)

Start when create new routine add lock

type DefaultModule

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

type ModuleErr

type ModuleErr struct {
	ID   int
	Name string
	Err  error
}

func (ModuleErr) Error

func (e ModuleErr) Error() error

func (ModuleErr) Int

func (e ModuleErr) Int() int

func (ModuleErr) String

func (e ModuleErr) String() string

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全局必須唯一

func (*ModuleManager) Destroy

func (mer *ModuleManager) Destroy()

func (*ModuleManager) Init

func (mer *ModuleManager) Init(app module.App)

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