package bhomeclient const ( PORT_DEFAULTPROXY int = 5000 KEY_REGISTER int = 101 //处理TOPIC_REGISTER / TOPIC_LEAVE和TOPIC_UPDATETOPIC KEY_HEARTBEAT int = 102 //处理TOPIC_HEARTBEAT KEY_QUERY int = 103 //处理TOPIC_QUERYKEY和TOPIC_QUERYTOPIC和TOPIC_QUERYPROC ) const ( TOPIC_SERFNODELISTUPDATE string = "Topic_SerfNodeListUpdate" TOPIC_QUERYSERFNODELIST string = "Topic_QuerySerfNodeList" TOPIC_REGISTER string = "Topic_Register" TOPIC_DEREGISTER string = "Topic_Deregister" TOPIC_HEARTBEAT string = "Topic_Heartbeat" TOPIC_UPDATETOPIC string = "Topic_UpdateTopic" TOPIC_QUERYKEY string = "Topic_QueryKey" TOPIC_QUERYTOPIC string = "Topic_QueryTopic" TOPIC_QUERYPROC string = "Topic_QueryProc" ) //const ( // REPLY_SUCCESS int = 200 // REPLY_FAILED int = 202 //) //type CommonReply struct { // Status int `json:"status"` // 请求状态,目前只有两个,成功返回200,失败202 // Desc string `json:"desc"` // 请求状态的描述,成功"success",失败返回失败原因,如心跳服务未启动 // Body []byte `json:"body"` // 返回值的具体内容,用户约定 //} const ( NODE_ALIVE int = 0 NODE_DEAD int = 1 ) type NodeList struct { Ip string `json:"ip"` Port int `json:"port"` } const ( MesgType_PubSub = "PUBSUB" MesgType_ReqRep = "REQREP" MesgType_SendOnly = "SENDONLY" ) type ServerInfo struct { // 节点基本信息 ID string `json:"id"` // 机器ID IP string `json:"ip"` // 机器IP Port int `json:"port"` // 端口,代理进程的端口 BoardID string `json:"boardId"` // 板卡ID Info string `json:"info"` // 附加信息 } type ProcInfo struct { Name string `json:"name"` // 进程名称 ID string `json:"id"` // 进程唯一标识 Info string `json:"info"` // 进程的描述信息,用于区分同一进程名称下多个进程 } type RegisterInfo struct { Proc ProcInfo `json:"proc"` // 进程的信息 Channel []string `json:"channel"` // 新增频道,对应一个新的共享内存队列 PubTopic []string `json:"pubTopic"` // 进程对外发布的服务主题 SubTopic []string `json:"subTopic"` // 进程订阅的服务主题 SubNetTopic []string `json:"subNetTopic"`// 订阅全网主题消息,集群内其他节点发布此topic消息,则订阅者可跨机收到 } //节点及topic-key对应关系 type NodeInfo struct { SvrInfo ServerInfo `json:"svrInfo"` //节点基本信息 Topic2Key map[string]int `json:"topic2Key"` //topic-replyKey的对应关系 Status int `json:"status"` //节点状态 } //已注册的Proc进程信息 type RegisteredClient struct { Info RegisterInfo `json:"info"` ReplyKey int `json:"replyKey"` HeartbeatCount int `json:"heartbeatCount"` DeadCount int `json:"deadCount"` Status int `json:"status"` }