clusterserver

package
v0.0.0-...-bfb5c6f Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2018 License: Apache-2.0 Imports: 15 Imported by: 13

Documentation

Index

Constants

View Source
const (
	KEEP_ALIVED_DURATION = 30 //s
)

Variables

This section is empty.

Functions

func DoCCConnectionLost

func DoCCConnectionLost(fconn iface.Iclient)

func DoCSConnectionLost

func DoCSConnectionLost(fconn iface.Iconnection)

func DoConnectionLost

func DoConnectionLost(fconn iface.Iconnection)

func DoConnectionMade

func DoConnectionMade(fconn iface.Iconnection)

func ReConnectMasterCB

func ReConnectMasterCB(fconn iface.Iclient)

reconnected to master

Types

type ClusterServer

type ClusterServer struct {
	Name           string
	RemoteNodesMgr *cluster.ChildMgr //子节点有
	ChildsMgr      *cluster.ChildMgr //root节点有
	MasterObj      *fnet.TcpClient

	NetServer    iface.Iserver
	RootServer   iface.Iserver
	TelnetServer iface.Iserver
	Cconf        *cluster.ClusterConf

	sync.RWMutex
	// contains filtered or unexported fields
}
var GlobalClusterServer *ClusterServer

func NewClusterServer

func NewClusterServer(name, path string) *ClusterServer

func (*ClusterServer) AddChild

func (this *ClusterServer) AddChild(name string, writer iface.IWriter)

子节点连上来回调

func (*ClusterServer) AddHttpRouter

func (this *ClusterServer) AddHttpRouter(router interface{})

注册http的api到分布式服务器

func (*ClusterServer) AddModule

func (this *ClusterServer) AddModule(mname string, apimodule interface{}, httpmodule interface{}, rpcmodule interface{})

注册模块到分布式服务器

func (*ClusterServer) AddRouter

func (this *ClusterServer) AddRouter(router interface{})

func (*ClusterServer) AddRpcRouter

func (this *ClusterServer) AddRpcRouter(router interface{})

func (*ClusterServer) ConnectToMaster

func (this *ClusterServer) ConnectToMaster()

func (*ClusterServer) ConnectToRemote

func (this *ClusterServer) ConnectToRemote(rname string)

func (*ClusterServer) GetRemote

func (this *ClusterServer) GetRemote(name string) (*cluster.Child, error)

func (*ClusterServer) RemoveChild

func (this *ClusterServer) RemoveChild(name string)

子节点断开回调

func (*ClusterServer) RemoveRemote

func (this *ClusterServer) RemoveRemote(name string)

func (*ClusterServer) StartClusterServer

func (this *ClusterServer) StartClusterServer()

func (*ClusterServer) WaitSignal

func (this *ClusterServer) WaitSignal()

type Master

type Master struct {
	OnlineNodes  map[string]bool
	Cconf        *cluster.ClusterConf
	Childs       *cluster.ChildMgr
	TelnetServer iface.Iserver
	sync.RWMutex
}
var GlobalMaster *Master

func NewMaster

func NewMaster(path string) *Master

func (*Master) AddNode

func (this *Master) AddNode(name string, writer iface.IWriter)

func (*Master) AddRpcRouter

func (this *Master) AddRpcRouter(router interface{})

func (*Master) CheckChildsAlive

func (this *Master) CheckChildsAlive(params ...interface{})

func (*Master) RemoveNode

func (this *Master) RemoveNode(name string)

func (*Master) StartMaster

func (this *Master) StartMaster()

Jump to

Keyboard shortcuts

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