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 MessageGetArgs
- type MessageGetResp
- type MessageNodeEvent
- type MessageSaveArgs
- type MessageSavePubArgs
- type OldMessage
- type RandLB
Constants ¶
View Source
const ( // group id PrivateGroupId = 0 PublicGroupId = 1 CometServicePushPrivate = "CometRPC.PushPrivate" )
View Source
const ( MessageService = "MessageRPC" MessageServiceGet = "MessageRPC.Get" MessageServiceSave = "MessageRPC.Save" MessageServiceClean = "MessageRPC.Clean" )
View Source
const ( // common // ok OK = 0 // param error ParamErr = 65534 // internal error InternalErr = 65535 )
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 GroupId uint // message group id 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 MessageGetArgs ¶
type MessageGetArgs struct { MsgId int64 // message id PubMsgId int64 // public message id Key string // subscriber key }
Message Get Args
type MessageGetResp ¶
Message Get Response
type MessageNodeEvent ¶
type MessageSaveArgs ¶
type MessageSaveArgs struct { Key string // subscriber key Msg json.RawMessage // message content MsgId int64 // message id GroupId uint // message group id Expire uint // message expire second }
Message Save Args
type MessageSavePubArgs ¶
type MessageSavePubArgs struct { MsgID int64 // message id Msg string // message content Expire int64 // message expire second }
Public Message Save 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.