master

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2020 License: MIT Imports: 16 Imported by: 1

Documentation

Index

Constants

View Source
const (
	NODE_NAME string = "master"
)

Variables

This section is empty.

Functions

func ParseCommands

func ParseCommands()

Types

type CmdHandlerFunc

type CmdHandlerFunc func(cmd, nodeId string, date []byte)

type IMaster

type IMaster interface {
	Run() error
	AddHandler(cmd string, handler CmdHandlerFunc)
	SendCMD(cmd, nodeId string, data []byte) (result []byte, err error)
	SendCMDJson(cmd, nodeId string, obj interface{}) (result []byte, err error)
	SendCMDProto(cmd, nodeId string, obj interface{}) (result []byte, err error)
	TimeOutServerListListener(tHandler TimeOutHandlerFunc)
	GetRunTimeMemStats(nodeId string) (*runtime.MemStats, error)
	Done()
	GetNodeInfos() map[string]*NodeInfo
	AddExceptionHandler(handler gnError.ExceptionHandleFunc)
}

func DefaultMaster

func DefaultMaster(conf *config.Config) (IMaster, error)

type Master

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

func (*Master) AddExceptionHandler

func (m *Master) AddExceptionHandler(handler gnError.ExceptionHandleFunc)

func (*Master) AddHandler

func (m *Master) AddHandler(cmd string, handler CmdHandlerFunc)

func (*Master) Done

func (m *Master) Done()

func (*Master) GetNodeInfos

func (m *Master) GetNodeInfos() map[string]*NodeInfo

func (*Master) GetRunTimeMemStats

func (m *Master) GetRunTimeMemStats(nodeId string) (*runtime.MemStats, error)

func (*Master) PingHandler

func (m *Master) PingHandler(cmd, nodeId string, date []byte)

func (*Master) Run

func (m *Master) Run() error

func (*Master) SendCMD

func (m *Master) SendCMD(cmd, nodeId string, data []byte) (result []byte, err error)

func (*Master) SendCMDJson added in v0.1.4

func (m *Master) SendCMDJson(cmd, nodeId string, obj interface{}) (result []byte, err error)

func (*Master) SendCMDProto added in v0.1.4

func (m *Master) SendCMDProto(cmd, nodeId string, obj interface{}) (result []byte, err error)

func (*Master) TimeOutServerListListener

func (m *Master) TimeOutServerListListener(tHandler TimeOutHandlerFunc)

type NodeInfo

type NodeInfo struct {
	NodeId     string
	LastTime   int64
	CurrenTime int64
	DiffTime   time.Duration
	RoutineNum int64
	Host       string
	Port       int
}

type TimeOutHandlerFunc

type TimeOutHandlerFunc func(list []NodeInfo)

Jump to

Keyboard shortcuts

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