Documentation
¶
Overview ¶
dispatcher包提供消息队列, 消息注册+派发 封装消息解包, 打包的过程
Index ¶
- func BuildPacket(data interface{}) (*Packet, *MessageMeta)
- func ParsePacket(pkt *Packet, msgType reflect.Type) (interface{}, error)
- func RegisterMessageMeta(name string, msg proto.Message, id uint32)
- func VisitMessageMeta(callback func(*MessageMeta))
- type Connector
- type EventDispatcher
- type EventPipe
- type EventQueue
- type MessageMeta
- type Packet
- type Peer
- type Session
- type SessionManager
- type Timer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterMessageMeta ¶
注册消息元信息(代码生成专用)
Types ¶
type EventDispatcher ¶
type EventDispatcher struct {
// contains filtered or unexported fields
}
func NewEventDispatcher ¶
func NewEventDispatcher() *EventDispatcher
func (*EventDispatcher) Add ¶
func (self *EventDispatcher) Add(name string, callback func(...interface{}))
func (*EventDispatcher) Clear ¶
func (self *EventDispatcher) Clear()
func (*EventDispatcher) Invoke ¶
func (self *EventDispatcher) Invoke(name string, args ...interface{})
func (*EventDispatcher) Remove ¶
func (self *EventDispatcher) Remove(name string, callback func(...interface{}))
type EventPipe ¶
type EventPipe interface { AddQueue() EventQueue Start() Stop(int) Wait() int }
func NewEventPipe ¶
func NewEventPipe() EventPipe
type EventQueue ¶
type EventQueue interface { // 注册事件回调 RegisterCallback(id uint32, f func(interface{})) // 设置事件截获钩子, 在CallData中调用钩子 InjectData(func(interface{}) bool) // 投递事件, 通过队列到达消费者端 PostData(data interface{}) // 直接调用消费者端的handler CallData(data interface{}) // 延时投递 DelayPostData(dur time.Duration, callback func()) // 开启并发模式, 回调被调用的线程为post方线程 EnableConcurrenceMode(enable bool) }
type MessageMeta ¶
type Peer ¶
type Peer interface { // 开启 Start(address string) Peer // 关闭 Stop() // 名字 SetName(string) Name() string // 事件 EventQueue // 连接管理 SessionManager }
type SessionManager ¶
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
本包只做mongodb的异步操作实现 只实现常用功能 复杂操作可以使用mongodb的原始接口进行操作
|
本包只做mongodb的异步操作实现 只实现常用功能 复杂操作可以使用mongodb的原始接口进行操作 |
proto
|
|
coredef
Generated by github.com/davyxu/cellnet/protoc-gen-msg DO NOT EDIT! Source: coredef.proto Package coredef is a generated protocol buffer package.
|
Generated by github.com/davyxu/cellnet/protoc-gen-msg DO NOT EDIT! Source: coredef.proto Package coredef is a generated protocol buffer package. |
Click to show internal directories.
Click to hide internal directories.