master

package
v0.0.0-...-833a7b1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Register        = "Register"        //子服务器注册到主服务器
	OnRegister      = "OnRegister"      //主服务器通知各个子服务器
	UnRegister      = "UnRegister"      //子服务器通知到主服务器
	OnUnRegister    = "OnUnRegister"    //主服务器通知各个子服务器
	GetAppStatus    = "GetAppStatus"    //获得各个子服务器状态
	ReportStatus    = "ReportStatus"    //子服务器报告自身状态
	SyncVersionCode = "SyncVersionCode" //同步版本号
	GetAppList      = "GetAppList"      //获得子服务器列表
	MasterStr       = "Master"          //主服务器标志
	UpdateStatus    = "UpdateStatus"    //主服务器同步子服务器状态
	Bye             = "Bye"
	UpdateInfo      = "UpdateInfo" //主服务器要求子服务器重新注册·
)

Functions

This section is empty.

Types

type AppStatus

type AppStatus struct {
	AppName           string
	Load              int32 //用0到100 表示负载高低
	ModuleStatus      []ModuleStatus
	ProcessIngNumbers int32 //正在处理中的请求数量
}

type ApplicationInfo

type ApplicationInfo struct {
	Name    string
	RpcInfo string
	Modules map[string][]*conf.ModuleSettings
}

type DefaultMasterClient

type DefaultMasterClient struct {
	MasterClient

	Name string
	// contains filtered or unexported fields
}

func NewMasterClient

func NewMasterClient(config conf.Master, appName string, app module.App, moduleManage *basemodule.ModuleManager) *DefaultMasterClient

func (*DefaultMasterClient) GetModule

func (m *DefaultMasterClient) GetModule(module string) *module.ServerSession

func (*DefaultMasterClient) GetModuleByByte

func (m *DefaultMasterClient) GetModuleByByte(appByteName byte) *module.ServerSession

func (*DefaultMasterClient) RegisterToServer

func (m *DefaultMasterClient) RegisterToServer()

func (*DefaultMasterClient) SetShutDownCallBack

func (m *DefaultMasterClient) SetShutDownCallBack(callback ShutDownCallBack)

func (*DefaultMasterClient) SetUpdateApplicationListCallBack

func (m *DefaultMasterClient) SetUpdateApplicationListCallBack(callback UpdateApplicationListCallBack)

func (*DefaultMasterClient) Shutdown

func (m *DefaultMasterClient) Shutdown()

func (*DefaultMasterClient) ToShutdown

func (m *DefaultMasterClient) ToShutdown()

type DefaultMasterServer

type DefaultMasterServer struct {
	Master

	Modules map[string][]OtherModuleInfo
	// contains filtered or unexported fields
}

func (*DefaultMasterServer) GetAppList

func (m *DefaultMasterServer) GetAppList(name string) []ApplicationInfo

func (*DefaultMasterServer) GetAppStatus

func (m *DefaultMasterServer) GetAppStatus(name string) []AppStatus

func (*DefaultMasterServer) Register

func (m *DefaultMasterServer) Register(info ApplicationInfo)

func (*DefaultMasterServer) ReportStatus

func (m *DefaultMasterServer) ReportStatus(status AppStatus)

func (*DefaultMasterServer) UnRegister

func (m *DefaultMasterServer) UnRegister(appName string)

type Master

type Master interface {
	Register(info ApplicationInfo)        //服务注册到master
	UnRegister(appName string)            //解除注册
	GetAppStatus(name string) []AppStatus // 获取可用服务状态
	GetAppList(name string) []ApplicationInfo
	ReportStatus(status AppStatus) // 报告状态
}

func NewMaster

func NewMaster(serverId string, masterConf conf.Master) Master

type MasterClient

type MasterClient interface {
	SetShutDownCallBack(callback ShutDownCallBack)                           //注册远程关闭回调
	SetUpdateApplicationListCallBack(callback UpdateApplicationListCallBack) //注册更新服务器列表回调
	GetModule(module string) *module.ServerSession                           //获取可用模块RPC信息
	GetModuleByByte(appByteName byte) *module.ServerSession                  //根据byte编号获取可用模块RPC信息
	Shutdown()                                                               //关闭服务
	ToShutdown()                                                             //主服务器关闭本服务
}

type ModuleStatus

type ModuleStatus struct {
	ModuleName  string
	Load        int32  //当前模块的使用频率
	MethodLoads string //方法的调用信息
}

type OtherModuleInfo

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

type ShutDownCallBack

type ShutDownCallBack func() //关闭某个服务

type UpdateApplicationListCallBack

type UpdateApplicationListCallBack func() // 更新服务器列表

Jump to

Keyboard shortcuts

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