Documentation ¶
Index ¶
- Constants
- Variables
- func InitComet(conn *zk.Conn, fpath string, retry, ping time.Duration)
- func InitMessage(conn *zk.Conn, fpath string, retry, ping time.Duration)
- type CometMigrateArgs
- type CometNewArgs
- type CometNodeEvent
- type CometNodeInfo
- type CometPushPrivateArgs
- type CometPushPublicArgs
- type Message
- type MessageGetPrivateArgs
- type MessageGetResp
- type MessageNodeEvent
- type MessageSavePrivateArgs
- type MessageSavePublishArgs
- type OldMessage
- type RandLB
Constants ¶
View Source
const ( // group id PrivateGroupId = 0 PublicGroupId = 1 // message rpc service MessageService = "MessageRPC" MessageServiceGetPrivate = "MessageRPC.GetPrivate" MessageServiceSavePrivate = "MessageRPC.SavePrivate" MessageServiceDelPrivate = "MessageRPC.DelPrivate" )
View Source
const ( // common // ok OK = 0 // param error ParamErr = 65534 // internal error InternalErr = 65535 )
View Source
const (
CometServicePushPrivate = "CometRPC.PushPrivate"
)
Variables ¶
View Source
var ( ErrRandLBLength = errors.New("clients and addrs length not match") ErrRandLBAddr = errors.New("clients map no addr key") )
View Source
var (
ErrCometRPC = errors.New("comet rpc call failed")
)
View Source
var (
ErrParam = errors.New("parameter error")
)
Functions ¶
Types ¶
type CometMigrateArgs ¶
type CometMigrateArgs struct { Nodes []string // current comet nodes Vnode int // ketama virtual node number }
Channel Migrate Args
type CometNewArgs ¶
type CometNewArgs struct { Expire int64 // message expire second Token string // auth token Key string // subscriber key }
Channel New Args
type CometNodeEvent ¶
type CometNodeEvent struct { // node name(node1, node2...) Key string // node info Value *CometNodeInfo // event type Event int }
type CometNodeInfo ¶
type CometNodeInfo struct { // The addr for subscribe, format like:map[Protocol]Addr Addr map[int][]string // The connection for Comet RPC CometRPC *RandLB }
func GetComet ¶
func GetComet(key string) *CometNodeInfo
GetComet get the node infomation under the node.
type CometPushPrivateArgs ¶
type CometPushPrivateArgs struct { Key string // subscriber key Msg json.RawMessage // message content Expire uint // message expire second }
Channel Push Private Message Args
type CometPushPublicArgs ¶
Channel Push Public Message Args
type Message ¶
type Message struct { Msg json.RawMessage `json:"msg"` // message content MsgId int64 `json:"mid"` // message id GroupId uint `json:"gid"` // group id }
The Message struct
type MessageGetPrivateArgs ¶ added in v1.0.3
Message Get Args
type MessageGetResp ¶
type MessageGetResp struct {
Msgs []*Message // messages
}
Message Get Response
type MessageNodeEvent ¶
type MessageSavePrivateArgs ¶ added in v1.0.3
type MessageSavePrivateArgs struct { Key string // subscriber key Msg json.RawMessage // message content MsgId int64 // message id Expire uint // message expire second }
Message SavePrivate Args
type MessageSavePublishArgs ¶ added in v1.0.3
type MessageSavePublishArgs struct { MsgID int64 // message id Msg string // message content Expire int64 // message expire second }
Message SavePublish Args
type OldMessage ¶
type OldMessage struct { Msg string `json:"msg"` // Message MsgId int64 `json:"mid"` // Message id GroupId uint `json:"gid"` // Group id }
The Old Message struct (Compatible), TODO remove it.
Click to show internal directories.
Click to hide internal directories.