event

package
v1.19.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2023 License: Apache-2.0 Imports: 5 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteEvent added in v1.19.3

func DeleteEvent(event IEvent)

func SetEventPoolSize added in v1.19.3

func SetEventPoolSize(eventPoolSize int)

Types

type Event

type Event struct {
	Type EventType
	Data interface{}
	// contains filtered or unexported fields
}

func NewEvent added in v1.19.3

func NewEvent() *Event

func (*Event) GetEventType

func (e *Event) GetEventType() EventType

func (*Event) IsRef

func (e *Event) IsRef() bool

func (*Event) Ref

func (e *Event) Ref()

func (*Event) Reset

func (e *Event) Reset()

func (*Event) UnRef

func (e *Event) UnRef()

type EventCallBack

type EventCallBack func(event IEvent)

事件接受器

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 IEvent)

type EventProcessor

type EventProcessor struct {
	IEventChannel
	// contains filtered or unexported fields
}

func (*EventProcessor) EventHandler

func (processor *EventProcessor) EventHandler(ev IEvent)

func (*EventProcessor) Init

func (processor *EventProcessor) Init(eventChannel IEventChannel)

func (*EventProcessor) RegEventReceiverFunc

func (processor *EventProcessor) RegEventReceiverFunc(eventType EventType, receiver IEventHandler, callback EventCallBack)

func (*EventProcessor) UnRegEventReceiverFun

func (processor *EventProcessor) UnRegEventReceiverFun(eventType EventType, receiver IEventHandler)

type EventType

type EventType int
const (
	ServiceRpcRequestEvent  EventType = -1
	ServiceRpcResponseEvent EventType = -2

	Sys_Event_Tcp              EventType = -3
	Sys_Event_Http_Event       EventType = -4
	Sys_Event_WebSocket        EventType = -5
	Sys_Event_Node_Event       EventType = -6
	Sys_Event_DiscoverService  EventType = -7
	Sys_Event_DiscardGoroutine EventType = -8
	Sys_Event_QueueTaskFinish  EventType = -9

	Sys_Event_User_Define EventType = 1
)

大于Sys_Event_User_Define给用户定义

type IEvent

type IEvent interface {
	GetEventType() EventType
}

type IEventChannel

type IEventChannel interface {
	PushEvent(ev IEvent) error
}

type IEventHandler

type IEventHandler interface {
	Init(processor IEventProcessor)
	GetEventProcessor() IEventProcessor //获得事件
	NotifyEvent(IEvent)
	Destroy()
	// contains filtered or unexported methods
}

func NewEventHandler

func NewEventHandler() IEventHandler

type IEventProcessor

type IEventProcessor interface {
	IEventChannel

	Init(eventChannel IEventChannel)
	EventHandler(ev IEvent)
	RegEventReceiverFunc(eventType EventType, receiver IEventHandler, callback EventCallBack)
	UnRegEventReceiverFun(eventType EventType, receiver IEventHandler)
	// contains filtered or unexported methods
}

func NewEventProcessor

func NewEventProcessor() IEventProcessor

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL