cluster

package
v0.0.0-...-6b053b6 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NsqMsgTypeRsp          = iota //回应消息
	NsqMsgTypeBroadcast           //广播消息
	NsqMsgTypeNotForResult        // 不用回请求的消息
	NsqMsgTypeForResult           //要回请求的消息
)

Variables

View Source
var (
	Processor       = lgob.NewProcessor()
	RequestInfoLock sync.Mutex
)
View Source
var (
	SelfName string
)

Functions

func AddClient

func AddClient(c *NsqClient)

func AsynCall

func AsynCall(serverName string, chanAsynRet chan *chanrpc.RetInfo, id string, args ...interface{})

func Broadcast

func Broadcast(serverName string, id string, args ...interface{})

func Call0

func Call0(serverName string, id string, args ...interface{}) error

func Call1

func Call1(serverName string, id string, args ...interface{}) (interface{}, error)

func ForEachRequest

func ForEachRequest(f func(id int64, request *RequestInfo))

func GetGameServerName

func GetGameServerName(id int) string

func GetHallServerName

func GetHallServerName(id int) string

func Go

func Go(serverName string, id string, args ...interface{})

func HasClient

func HasClient(name string) bool

func NewNsqHandler

func NewNsqHandler() *nsqHandler

func Publish

func Publish(msg *S2S_NsqMsg) error

func RemoveClient

func RemoveClient(serverName string)

func SetRouter

func SetRouter(msgID string, server *chanrpc.Server)

func Start

func Start(cfg *Cluster_config)

func Stop

func Stop()

func TimeOutCall1

func TimeOutCall1(serverName string, t time.Duration, id string, args ...interface{}) (interface{}, error)

timeOutCall 会丢弃执行结果

Types

type Cluster_config

type Cluster_config struct {
	LogLv              string
	Channel            string   //唯一标识
	Csmtopics          []string //需要订阅的主题
	CsmUserAgent       string   //消费者的UserAgent
	CsmNsqdAddrs       []string
	CsmNsqLookupdAddrs []string
	CsmMaxInFlight     int
	PdrNsqdAddr        string //生产者需要连接的nsqd地址
	PdrUserAgent       string //生产者的UserAgent
	PdrMaxInFlight     int
	SelfName           string
}

type NsqClient

type NsqClient struct {
	Addr       string
	ServerName string
}

type RequestInfo

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

type S2S_NsqMsg

type S2S_NsqMsg struct {
	RequestID     int64
	MsgID         string
	MsgType       uint8
	SrcServerName string
	DstServerName string
	Args          []interface{}
	Err           string
	PushCnt       int
}

Jump to

Keyboard shortcuts

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