cluster

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: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	QUIT_CMD = [3]string{"quit", "q", "exit"}
)

Functions

This section is empty.

Types

type AsyncResult

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

func NewAsyncResult

func NewAsyncResult(key string) *AsyncResult

func (*AsyncResult) GetKey

func (this *AsyncResult) GetKey() string

func (*AsyncResult) GetResult

func (this *AsyncResult) GetResult(timeout time.Duration) (*RpcData, error)

func (*AsyncResult) SetResult

func (this *AsyncResult) SetResult(data *RpcData)

type AsyncResultMgr

type AsyncResultMgr struct {
	sync.RWMutex
	// contains filtered or unexported fields
}
var AResultGlobalObj *AsyncResultMgr = NewAsyncResultMgr()

func NewAsyncResultMgr

func NewAsyncResultMgr() *AsyncResultMgr

func (*AsyncResultMgr) Add

func (this *AsyncResultMgr) Add() *AsyncResult

func (*AsyncResultMgr) FillAsyncResult

func (this *AsyncResultMgr) FillAsyncResult(key string, data *RpcData) error

func (*AsyncResultMgr) GetAsyncResult

func (this *AsyncResultMgr) GetAsyncResult(key string) (*AsyncResult, error)

func (*AsyncResultMgr) Remove

func (this *AsyncResultMgr) Remove(key string)

type Child

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

func NewChild

func NewChild(name string, conn iface.IWriter) *Child

func (*Child) CallChildForResult

func (this *Child) CallChildForResult(target string, args ...interface{}) (*RpcData, error)

func (*Child) CallChildNotForResult

func (this *Child) CallChildNotForResult(target string, args ...interface{}) error

func (*Child) GetName

func (this *Child) GetName() string

type ChildMgr

type ChildMgr struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewChildMgr

func NewChildMgr() *ChildMgr

func (*ChildMgr) AddChild

func (this *ChildMgr) AddChild(name string, conn iface.IWriter)

func (*ChildMgr) GetChild

func (this *ChildMgr) GetChild(name string) (*Child, error)

func (*ChildMgr) GetChilds

func (this *ChildMgr) GetChilds() []*Child

func (*ChildMgr) GetChildsByPrefix

func (this *ChildMgr) GetChildsByPrefix(namePrefix string) []*Child

func (*ChildMgr) GetRandomChild

func (this *ChildMgr) GetRandomChild(namesuffix string) *Child

func (*ChildMgr) RemoveChild

func (this *ChildMgr) RemoveChild(name string)

type ClusterConf

type ClusterConf struct {
	Master  *ClusterServerConf
	Servers map[string]*ClusterServerConf
}

func NewClusterConf

func NewClusterConf(path string) (*ClusterConf, error)

func (*ClusterConf) GetChildsByName

func (this *ClusterConf) GetChildsByName(name string) []string

获取当前节点的子节点

func (*ClusterConf) GetRemotesByName

func (this *ClusterConf) GetRemotesByName(name string) ([]string, error)

获取当前节点的父节点

func (*ClusterConf) Reload

func (this *ClusterConf) Reload()

type ClusterServerConf

type ClusterServerConf struct {
	Name      string
	Host      string
	RootPort  int
	Http      []interface{} //[port, staticfile_path]
	Https     []interface{} //[port, certFile, keyFile, staticfile_path]
	NetPort   int
	DebugPort int //telnet port
	Remotes   []string
	Module    string
	Log       string
}

type CommandInterpreter

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

func NewCommandInterpreter

func NewCommandInterpreter() *CommandInterpreter

func (*CommandInterpreter) AddCommand

func (this *CommandInterpreter) AddCommand(cmd iface.ICommand)

func (*CommandInterpreter) Excute

func (this *CommandInterpreter) Excute(rawCmdExp string) string

func (*CommandInterpreter) IsQuitCmd

func (this *CommandInterpreter) IsQuitCmd(rawCmdExp string) bool

type RpcClientProtocol

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

func NewRpcClientProtocol

func NewRpcClientProtocol() *RpcClientProtocol

func (*RpcClientProtocol) AddRpcRouter

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

func (*RpcClientProtocol) GetDataPack

func (this *RpcClientProtocol) GetDataPack() iface.Idatapack

func (*RpcClientProtocol) GetMsgHandle

func (this *RpcClientProtocol) GetMsgHandle() iface.Imsghandle

func (*RpcClientProtocol) InitWorker

func (this *RpcClientProtocol) InitWorker(poolsize int32)

func (*RpcClientProtocol) OnConnectionLost

func (this *RpcClientProtocol) OnConnectionLost(fconn iface.Iclient)

func (*RpcClientProtocol) OnConnectionMade

func (this *RpcClientProtocol) OnConnectionMade(fconn iface.Iclient)

func (*RpcClientProtocol) StartReadThread

func (this *RpcClientProtocol) StartReadThread(fconn iface.Iclient)

type RpcData

type RpcData struct {
	MsgType RpcSignal              `json:"msgtype"`
	Key     string                 `json:"key,omitempty"`
	Target  string                 `json:"target,omitempty"`
	Args    []interface{}          `json:"args,omitempty"`
	Result  map[string]interface{} `json:"result,omitempty"`
}

type RpcDataPack

type RpcDataPack struct{}

func NewRpcDataPack

func NewRpcDataPack() *RpcDataPack

func (*RpcDataPack) GetHeadLen

func (this *RpcDataPack) GetHeadLen() int32

func (*RpcDataPack) Pack

func (this *RpcDataPack) Pack(msgId uint32, pkg interface{}) (out []byte, err error)

func (*RpcDataPack) Unpack

func (this *RpcDataPack) Unpack(headdata []byte) (interface{}, error)

type RpcMsgHandle

type RpcMsgHandle struct {
	PoolSize  int32
	TaskQueue []chan *RpcRequest
	Apis      map[string]reflect.Value
}

func NewRpcMsgHandle

func NewRpcMsgHandle() *RpcMsgHandle

func (*RpcMsgHandle) AddRouter

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

func (*RpcMsgHandle) DeliverToMsgQueue

func (this *RpcMsgHandle) DeliverToMsgQueue(pkg interface{})

func (*RpcMsgHandle) DoMsg

func (this *RpcMsgHandle) DoMsg(request *RpcRequest)

处理rpc消息

func (*RpcMsgHandle) DoMsgFromGoRoutine

func (this *RpcMsgHandle) DoMsgFromGoRoutine(pkg interface{})

func (*RpcMsgHandle) StartWorkerLoop

func (this *RpcMsgHandle) StartWorkerLoop(poolSize int)

type RpcPackege

type RpcPackege struct {
	Len  int32
	Data []byte
}

type RpcRequest

type RpcRequest struct {
	Fconn   iface.IWriter
	Rpcdata *RpcData
}

type RpcServerProtocol

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

func NewRpcServerProtocol

func NewRpcServerProtocol() *RpcServerProtocol

func (*RpcServerProtocol) AddRpcRouter

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

func (*RpcServerProtocol) GetDataPack

func (this *RpcServerProtocol) GetDataPack() iface.Idatapack

func (*RpcServerProtocol) GetMsgHandle

func (this *RpcServerProtocol) GetMsgHandle() iface.Imsghandle

func (*RpcServerProtocol) InitWorker

func (this *RpcServerProtocol) InitWorker(poolsize int32)

func (*RpcServerProtocol) OnConnectionLost

func (this *RpcServerProtocol) OnConnectionLost(fconn iface.Iconnection)

func (*RpcServerProtocol) OnConnectionMade

func (this *RpcServerProtocol) OnConnectionMade(fconn iface.Iconnection)

func (*RpcServerProtocol) StartReadThread

func (this *RpcServerProtocol) StartReadThread(fconn iface.Iconnection)

type RpcSignal

type RpcSignal int32
const (
	REQUEST_NORESULT RpcSignal = iota
	REQUEST_FORRESULT
	RESPONSE
)

type TelnetProtocol

type TelnetProtocol struct{}

func NewTelnetProtocol

func NewTelnetProtocol() *TelnetProtocol

func (*TelnetProtocol) AddRpcRouter

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

func (*TelnetProtocol) GetDataPack

func (this *TelnetProtocol) GetDataPack() iface.Idatapack

func (*TelnetProtocol) GetMsgHandle

func (this *TelnetProtocol) GetMsgHandle() iface.Imsghandle

func (*TelnetProtocol) InitWorker

func (this *TelnetProtocol) InitWorker(poolsize int32)

func (*TelnetProtocol) OnConnectionLost

func (this *TelnetProtocol) OnConnectionLost(fconn iface.Iconnection)

func (*TelnetProtocol) OnConnectionMade

func (this *TelnetProtocol) OnConnectionMade(fconn iface.Iconnection)

func (*TelnetProtocol) StartReadThread

func (this *TelnetProtocol) StartReadThread(fconn iface.Iconnection)

type XingoRpc

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

func NewXingoRpc

func NewXingoRpc(conn iface.IWriter) *XingoRpc

func (*XingoRpc) CallRpcForResult

func (this *XingoRpc) CallRpcForResult(target string, args ...interface{}) (*RpcData, error)

func (*XingoRpc) CallRpcNotForResult

func (this *XingoRpc) CallRpcNotForResult(target string, args ...interface{}) error

Jump to

Keyboard shortcuts

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