Documentation ¶
Overview ¶
Package event @Title 事件类型 @Description 事件类型 @Author yr 2024/7/19 下午3:40 @Update yr 2024/7/19 下午3:40
Package event @Title 事件处理器 @Description 用于给事件一个注册绑定,标注这个事件在哪里注册过 @Author yr 2024/7/19 下午3:31 @Update yr 2024/7/19 下午3:31
Package event @Title 事件处理器接口 @Description 事件处理器接口 @Author yr 2024/7/19 下午3:19 @Update yr 2024/7/19 下午3:19
Package event @Title 事件管理器 @Description 这里管理着所有已经注册的事件,一般是一个service一个processor,事件触发时分发到不同的handler,并执行回调 @Author yr 2024/7/19 下午3:33 @Update yr 2024/7/19 下午3:33
Index ¶
- Constants
- func ReleaseEvent(e *Event)
- type CallBack
- type Event
- type EventCallBack
- type EventHandler
- type EventProcessor
- func (processor *EventProcessor) EventHandler(ev inf.IEvent)
- func (processor *EventProcessor) Init(eventChannel IEventChannel)
- func (processor *EventProcessor) RegEventReceiverFunc(eventType def.EventType, receiver IEventHandler, callback EventCallBack)
- func (processor *EventProcessor) UnRegEventReceiverFun(eventType def.EventType, receiver IEventHandler)
- type EventType
- type Handler
- type IChannel
- type IEventChannel
- type IEventHandler
- type IEventProcessor
- type IHandler
- type IProcessor
- type Processor
Constants ¶
View Source
const ( // 基础事件 -1000以上 系统事件 -1 到 -999 用户事件 1 - 99 SysEventWebsocket = -5 SysEventRpc = -1001 // 远程调用事件 SysEventReply = -1002 // 远程调用回复事件 SysEventClientMsg = -1003 // 客户端消息事件 SysEventETCDPut = -1004 // etcd 存储事件 SysEventETCDDel = -1005 // etcd 删除事件 SysEventServiceReg = -1006 // 服务注册事件 SysEventServiceDis = -1007 // 服务注销事件 SysEventNodeConn = -1010 // 节点连接事件 SysEventNatsConn = -1011 // nats 连接事件 MaxType = -1000 )
Variables ¶
This section is empty.
Functions ¶
func ReleaseEvent ¶
func ReleaseEvent(e *Event)
Types ¶
type Event ¶
type EventHandler ¶
type EventHandler struct {
// contains filtered or unexported fields
}
func (*EventHandler) Destroy ¶
func (handler *EventHandler) Destroy()
func (*EventHandler) GetEventProcessor ¶
func (handler *EventHandler) GetEventProcessor() IEventProcessor
func (*EventHandler) Init ¶
func (handler *EventHandler) Init(processor IEventProcessor)
func (*EventHandler) NotifyEvent ¶
func (handler *EventHandler) NotifyEvent(ev inf.IEvent)
type EventProcessor ¶
type EventProcessor struct { IEventChannel // contains filtered or unexported fields }
func (*EventProcessor) EventHandler ¶
func (processor *EventProcessor) EventHandler(ev inf.IEvent)
func (*EventProcessor) Init ¶
func (processor *EventProcessor) Init(eventChannel IEventChannel)
func (*EventProcessor) RegEventReceiverFunc ¶
func (processor *EventProcessor) RegEventReceiverFunc(eventType def.EventType, receiver IEventHandler, callback EventCallBack)
func (*EventProcessor) UnRegEventReceiverFun ¶
func (processor *EventProcessor) UnRegEventReceiverFun(eventType def.EventType, receiver IEventHandler)
type Handler ¶
func (*Handler) GetEventProcessor ¶
func (h *Handler) GetEventProcessor() IProcessor
func (*Handler) Init ¶
func (h *Handler) Init(p IProcessor)
func (*Handler) NotifyEvent ¶
func (h *Handler) NotifyEvent(ev IEvent)
type IEventChannel ¶
type IEventHandler ¶
type IEventHandler interface { Init(processor IEventProcessor) GetEventProcessor() IEventProcessor //获得事件 NotifyEvent(inf.IEvent) Destroy() // contains filtered or unexported methods }
func NewEventHandler ¶
func NewEventHandler() IEventHandler
type IEventProcessor ¶
type IEventProcessor interface { IEventChannel Init(eventChannel IEventChannel) EventHandler(ev inf.IEvent) RegEventReceiverFunc(eventType def.EventType, receiver IEventHandler, callback EventCallBack) UnRegEventReceiverFun(eventType def.EventType, receiver IEventHandler) // contains filtered or unexported methods }
func NewEventProcessor ¶
func NewEventProcessor() IEventProcessor
type IHandler ¶
type IHandler interface { Init(p IProcessor) GetEventProcessor() IProcessor NotifyEvent(IEvent) Destroy() // contains filtered or unexported methods }
func NewHandler ¶
func NewHandler() IHandler
type IProcessor ¶
type IProcessor interface { IChannel Init(eventChannel IChannel) EventHandler(ev IEvent) RegEventReceiverFunc(eventType int, receiver IHandler, callback CallBack) UnRegEventReceiverFun(eventType int, receiver IHandler) // contains filtered or unexported methods }
func NewProcessor ¶
func NewProcessor() IProcessor
type Processor ¶
type Processor struct { IChannel // contains filtered or unexported fields }
func (*Processor) RegEventReceiverFunc ¶
RegEventReceiverFunc 注册事件处理函数
func (*Processor) UnRegEventReceiverFun ¶
UnRegEventReceiverFun 取消注册
Click to show internal directories.
Click to hide internal directories.