service

package
v0.0.0-...-a538cea Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const InitModuleId = 1e17

Variables

This section is empty.

Functions

func Init

func Init(chanCloseSig chan bool)

func Setup

func Setup(s IService) bool

func Start

func Start()

func WaitStop

func WaitStop()

Types

type IModule

type IModule interface {
	SetModuleId(moduleId int64) bool
	GetModuleId() int64
	AddModule(module IModule) (int64, error)
	GetModule(moduleId int64) IModule
	GetAncestor() IModule
	ReleaseModule(moduleId int64)
	NewModuleId() int64
	GetParent() IModule
	OnInit() error
	OnRelease()

	GetService() IService
	GetModuleName() string
	GetEventProcessor() event.IEventProcessor
	NotifyEvent(ev *event.Event)
	// contains filtered or unexported methods
}

type IService

type IService interface {
	Init(iservice IService, getClientFun rpc.FuncRpcClient, getServerFun rpc.FuncRpcServer, serviceCfg interface{})
	GetName() string

	OnSetup(iservice IService)
	OnInit() error
	OnRelease()
	Wait()
	Start()
	GetRpcHandler() rpc.IRpcHandler
	GetServiceCfg() interface{}
	OpenProfiler()
	GetProfiler() *profiler.Profiler
}

func GetService

func GetService(servicename string) IService

type Module

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

1.管理各模块树层关系 2.提供定时器常用工具

func (*Module) AddModule

func (slf *Module) AddModule(module IModule) (int64, error)

func (*Module) AfterFunc

func (slf *Module) AfterFunc(d time.Duration, cb func()) *timer.Timer

func (*Module) CronFunc

func (slf *Module) CronFunc(cronExpr *timer.CronExpr, cb func()) *timer.Cron

func (*Module) GetAncestor

func (slf *Module) GetAncestor() IModule

func (*Module) GetEventHandler

func (slf *Module) GetEventHandler() event.IEventHandler

func (*Module) GetEventProcessor

func (slf *Module) GetEventProcessor() event.IEventProcessor

func (*Module) GetModule

func (slf *Module) GetModule(moduleId int64) IModule

func (*Module) GetModuleId

func (slf *Module) GetModuleId() int64

func (*Module) GetModuleName

func (slf *Module) GetModuleName() string

func (*Module) GetParent

func (slf *Module) GetParent() IModule

func (*Module) GetService

func (slf *Module) GetService() IService

func (*Module) NewModuleId

func (slf *Module) NewModuleId() int64

func (*Module) NotifyEvent

func (slf *Module) NotifyEvent(ev *event.Event)

func (*Module) OnInit

func (slf *Module) OnInit() error

func (*Module) OnRelease

func (slf *Module) OnRelease()

func (*Module) ReleaseModule

func (slf *Module) ReleaseModule(moduleId int64)

func (*Module) SetModuleId

func (slf *Module) SetModuleId(moduleId int64) bool

type Service

type Service struct {
	Module
	rpc.RpcHandler //rpc
	// contains filtered or unexported fields
}

func (*Service) GetName

func (slf *Service) GetName() string

func (*Service) GetProfiler

func (slf *Service) GetProfiler() *profiler.Profiler

func (*Service) GetServiceCfg

func (slf *Service) GetServiceCfg() interface{}

func (*Service) Init

func (slf *Service) Init(iservice IService, getClientFun rpc.FuncRpcClient, getServerFun rpc.FuncRpcServer, serviceCfg interface{})

func (*Service) OnInit

func (slf *Service) OnInit() error

func (*Service) OnRelease

func (slf *Service) OnRelease()

func (*Service) OnSetup

func (slf *Service) OnSetup(iservice IService)

func (*Service) OpenProfiler

func (slf *Service) OpenProfiler()

func (*Service) RegEventReciverFunc

func (slf *Service) RegEventReciverFunc(eventType event.EventType, reciver event.IEventHandler, callback event.EventCallBack)

func (*Service) Release

func (slf *Service) Release()

func (*Service) Run

func (slf *Service) Run()

func (*Service) SetGoRouterNum

func (slf *Service) SetGoRouterNum(gorouterNum int32) bool

func (*Service) Start

func (slf *Service) Start()

func (*Service) UnRegEventReciverFun

func (slf *Service) UnRegEventReciverFun(eventType event.EventType, reciver event.IEventHandler)

func (*Service) Wait

func (slf *Service) Wait()

Jump to

Keyboard shortcuts

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