executor

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: MulanPSL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPoolSize int64 = 10000
	DefaultChanSize int64 = 1000
)

Variables

This section is empty.

Functions

func FireEvent

func FireEvent(e Event)

func FireEventWait

func FireEventWait(e Event) (result interface{}, ok bool)

func NewRoutine

func NewRoutine(ChanSize int64) (ret *routine)

Types

type DefaultEventHandlerContext

type DefaultEventHandlerContext struct {
	Name string
	Next *DefaultEventHandlerContext
	Prev *DefaultEventHandlerContext
	// contains filtered or unexported fields
}

func NewDefaultEventHandlerContext

func NewDefaultEventHandlerContext(name string, pipeline EventPipeline, handler EventHandler) (context *DefaultEventHandlerContext)

func (*DefaultEventHandlerContext) FireExceptionCaught

func (this *DefaultEventHandlerContext) FireExceptionCaught(err error) (invoker EventInboundInvoker)

func (*DefaultEventHandlerContext) FireUpEvent

func (this *DefaultEventHandlerContext) FireUpEvent(event interface{}) (invoker EventInboundInvoker)

func (*DefaultEventHandlerContext) Get

func (this *DefaultEventHandlerContext) Get(key string) (value interface{})

func (*DefaultEventHandlerContext) Handler

func (this *DefaultEventHandlerContext) Handler() (handler EventHandler)

func (*DefaultEventHandlerContext) Pipeline

func (this *DefaultEventHandlerContext) Pipeline() (pipeline EventPipeline)

func (*DefaultEventHandlerContext) Set

func (this *DefaultEventHandlerContext) Set(key string, value interface{})

type DefaultEventPipeline

type DefaultEventPipeline struct {
	Lock *sync.Mutex
	Head *DefaultEventHandlerContext
	Tail *DefaultEventHandlerContext
}

func NewDefaultEventPipeline

func NewDefaultEventPipeline() (pipeline *DefaultEventPipeline)

func (*DefaultEventPipeline) AddFirst

func (this *DefaultEventPipeline) AddFirst(name string, handler EventHandler) (pipeline EventPipeline)

func (*DefaultEventPipeline) AddLast

func (this *DefaultEventPipeline) AddLast(name string, handler EventHandler) (pipeline EventPipeline)

func (*DefaultEventPipeline) FireExceptionCaught

func (this *DefaultEventPipeline) FireExceptionCaught(err error) (invoker EventInboundInvoker)

func (*DefaultEventPipeline) FireUpEvent

func (this *DefaultEventPipeline) FireUpEvent(event interface{}) (invoker EventInboundInvoker)

type Event

type Event interface {
	/**
	 * 为保证事件序列化执行,需要序列化执行的事件必须提供一致的queueId
	 * */
	QueueId() (queueId int64)
	Exec()
	Wait() (result interface{}, ok bool)
}

type EventHandler

type EventHandler interface {
	OnExceptionCaught(ctx EventHandlerContext, err error)
}

type EventHandlerContext

type EventHandlerContext interface {
	EventInboundInvoker
	Handler() (handler EventHandler)
	Pipeline() (pipeline EventPipeline)
}

type EventInboundHandler

type EventInboundHandler interface {
	EventHandler
	OnEventUp(ctx EventHandlerContext, e interface{}) (ret interface{})
}

type EventInboundInvoker

type EventInboundInvoker interface {
	FireExceptionCaught(err error) (invoker EventInboundInvoker)
	FireUpEvent(event interface{}) (invoker EventInboundInvoker)
}

type EventInitializer

type EventInitializer interface {
	InitChannel(pipeline EventPipeline)
}

type EventPipeline

type EventPipeline interface {
	EventInboundInvoker
	AddFirst(name string, handler EventHandler) (pipeline EventPipeline)
	AddLast(name string, handler EventHandler) (pipeline EventPipeline)
}

type HeadHandler

type HeadHandler struct {
}

func (*HeadHandler) OnEventUp

func (this *HeadHandler) OnEventUp(ctx EventHandlerContext, e interface{}) (ret interface{})

func (*HeadHandler) OnExceptionCaught

func (this *HeadHandler) OnExceptionCaught(ctx EventHandlerContext, err error)

type IExecutor

type IExecutor interface {
	FireEvent(e Event)
	FireEventWait(e Event) (result interface{}, ok bool)
}

type IRoutinePoolBuilder

type IRoutinePoolBuilder interface {
	GetRoutinePool(int64) *RoutinePool
}

type RoutinePool

type RoutinePool struct {
	// contains filtered or unexported fields
}

func NewRoutinePool

func NewRoutinePool(PoolSize int64, ChanSize int64) (pool *RoutinePool)

func (*RoutinePool) Exec

func (this *RoutinePool) Exec(event Event)

func (*RoutinePool) FireEvent

func (this *RoutinePool) FireEvent(e Event)

func (*RoutinePool) FireEventWait

func (this *RoutinePool) FireEventWait(e Event) (result interface{}, ok bool)

发送内部STS消息(玩家不一定在线)

func (*RoutinePool) ShutDown

func (this *RoutinePool) ShutDown()

type TailHandler

type TailHandler struct {
}

func (*TailHandler) OnEventUp

func (this *TailHandler) OnEventUp(ctx EventHandlerContext, e interface{}) (ret interface{})

func (*TailHandler) OnExceptionCaught

func (this *TailHandler) OnExceptionCaught(ctx EventHandlerContext, err error)

Jump to

Keyboard shortcuts

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