Documentation
¶
Index ¶
- func DefaultWorkerExecutor(handler cherryInterfaces.IHandler, worker *Worker)
- type FilterFn
- type Handler
- func (h *Handler) AfterInit()
- func (h *Handler) GetEvent(name string) ([]cherryInterfaces.EventFn, bool)
- func (h *Handler) GetEvents() map[string][]cherryInterfaces.EventFn
- func (h *Handler) GetLocal(funcName string) (*cherryInterfaces.InvokeFn, bool)
- func (h *Handler) GetLocals() map[string]*cherryInterfaces.InvokeFn
- func (h *Handler) GetRemote(funcName string) (*cherryInterfaces.InvokeFn, bool)
- func (h *Handler) GetRemotes() map[string]*cherryInterfaces.InvokeFn
- func (h *Handler) GetWorker(message interface{}) *Worker
- func (h *Handler) HandlerComponent() *HandlerComponent
- func (h *Handler) Init()
- func (h *Handler) Name() string
- func (h *Handler) PostEvent(e cherryInterfaces.IEvent)
- func (h *Handler) PreInit()
- func (h *Handler) PutMessage(message interface{})
- func (h *Handler) RegisterEvent(eventName string, fn cherryInterfaces.EventFn)
- func (h *Handler) RegisterLocal(name string, fn interface{})
- func (h *Handler) RegisterLocals(sliceFn ...interface{})
- func (h *Handler) RegisterRemote(name string, fn interface{})
- func (h *Handler) RegisterRemotes(sliceFn ...interface{})
- func (h *Handler) SetName(name string)
- func (h *Handler) Stop()
- type HandlerComponent
- func (h *HandlerComponent) DoHandle(msg *UnhandledMessage)
- func (h *HandlerComponent) GetHandler(route *cherryRoute.Route) cherryInterfaces.IHandler
- func (h *HandlerComponent) Init()
- func (h *HandlerComponent) Name() string
- func (h *HandlerComponent) PostEvent(event cherryInterfaces.IEvent)
- func (h *HandlerComponent) RegisterWithName(name string, handler cherryInterfaces.IHandler)
- func (h *HandlerComponent) Registers(handlers ...cherryInterfaces.IHandler)
- func (h *HandlerComponent) Stop()
- type HandlerComponentOptions
- func (c *HandlerComponentOptions) AfterFilter(afterFilters ...FilterFn)
- func (c *HandlerComponentOptions) BeforeFilter(beforeFilters ...FilterFn)
- func (c *HandlerComponentOptions) GetAfterFilter() []FilterFn
- func (c *HandlerComponentOptions) GetBeforeFilter() []FilterFn
- func (*HandlerComponentOptions) NodeRoute(nodeType string, routeFunc cherryInterfaces.RouteFunction)
- func (c *HandlerComponentOptions) SetNameFn(fn func(string) string)
- type UnhandledMessage
- type Worker
- type WorkerExecuteFn
- type WorkerGroup
- func (w *WorkerGroup) SetQueueSize(size int)
- func (w *WorkerGroup) SetWorkerCRC32Hash(workerSize int)
- func (w *WorkerGroup) SetWorkerExecutor(workerExecuteFn WorkerExecuteFn)
- func (w *WorkerGroup) SetWorkerHash(workerSize int, hashFn WorkerHashFn)
- func (w *WorkerGroup) SetWorkerRandHash(workerSize int)
- func (w *WorkerGroup) WorkerMap() map[int]*Worker
- type WorkerHashFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultWorkerExecutor ¶
func DefaultWorkerExecutor(handler cherryInterfaces.IHandler, worker *Worker)
DefaultWorkerExecutor
Types ¶
type FilterFn ¶
type FilterFn func(msg *UnhandledMessage) bool
type Handler ¶
type Handler struct { cherryInterfaces.AppContext WorkerGroup // contains filtered or unexported fields }
func (*Handler) GetRemotes ¶
func (*Handler) HandlerComponent ¶
func (h *Handler) HandlerComponent() *HandlerComponent
func (*Handler) PutMessage ¶
func (h *Handler) PutMessage(message interface{})
func (*Handler) RegisterEvent ¶
RegisterEvent
func (*Handler) RegisterLocal ¶
func (*Handler) RegisterLocals ¶
func (h *Handler) RegisterLocals(sliceFn ...interface{})
func (*Handler) RegisterRemote ¶
func (*Handler) RegisterRemotes ¶
func (h *Handler) RegisterRemotes(sliceFn ...interface{})
type HandlerComponent ¶
type HandlerComponent struct { cherryInterfaces.BaseComponent // base component HandlerComponentOptions // opts // contains filtered or unexported fields }
handlerComponent Handler component
func NewComponent ¶
func NewComponent() *HandlerComponent
func (*HandlerComponent) DoHandle ¶
func (h *HandlerComponent) DoHandle(msg *UnhandledMessage)
func (*HandlerComponent) GetHandler ¶
func (h *HandlerComponent) GetHandler(route *cherryRoute.Route) cherryInterfaces.IHandler
func (*HandlerComponent) Init ¶
func (h *HandlerComponent) Init()
func (*HandlerComponent) Name ¶
func (h *HandlerComponent) Name() string
func (*HandlerComponent) PostEvent ¶
func (h *HandlerComponent) PostEvent(event cherryInterfaces.IEvent)
PostEvent 发布事件
func (*HandlerComponent) RegisterWithName ¶
func (h *HandlerComponent) RegisterWithName(name string, handler cherryInterfaces.IHandler)
func (*HandlerComponent) Registers ¶
func (h *HandlerComponent) Registers(handlers ...cherryInterfaces.IHandler)
func (*HandlerComponent) Stop ¶
func (h *HandlerComponent) Stop()
type HandlerComponentOptions ¶
type HandlerComponentOptions struct {
// contains filtered or unexported fields
}
func (*HandlerComponentOptions) AfterFilter ¶
func (c *HandlerComponentOptions) AfterFilter(afterFilters ...FilterFn)
func (*HandlerComponentOptions) BeforeFilter ¶
func (c *HandlerComponentOptions) BeforeFilter(beforeFilters ...FilterFn)
func (*HandlerComponentOptions) GetAfterFilter ¶
func (c *HandlerComponentOptions) GetAfterFilter() []FilterFn
func (*HandlerComponentOptions) GetBeforeFilter ¶
func (c *HandlerComponentOptions) GetBeforeFilter() []FilterFn
func (*HandlerComponentOptions) NodeRoute ¶
func (*HandlerComponentOptions) NodeRoute(nodeType string, routeFunc cherryInterfaces.RouteFunction)
NodeRoute 结点路由规则 nodeType:结点类型,routeFunc 路由规则
func (*HandlerComponentOptions) SetNameFn ¶
func (c *HandlerComponentOptions) SetNameFn(fn func(string) string)
type UnhandledMessage ¶
type UnhandledMessage struct { Session cherryInterfaces.ISession Route *cherryRoute.Route Msg *cherryMessage.Message }
type Worker ¶
type Worker struct { Index int // index MessageChan chan interface{} // message chan }
type WorkerExecuteFn ¶
type WorkerExecuteFn func(handler cherryInterfaces.IHandler, worker *Worker)
type WorkerGroup ¶
type WorkerGroup struct {
// contains filtered or unexported fields
}
func (*WorkerGroup) SetQueueSize ¶
func (w *WorkerGroup) SetQueueSize(size int)
func (*WorkerGroup) SetWorkerCRC32Hash ¶
func (w *WorkerGroup) SetWorkerCRC32Hash(workerSize int)
func (*WorkerGroup) SetWorkerExecutor ¶
func (w *WorkerGroup) SetWorkerExecutor(workerExecuteFn WorkerExecuteFn)
func (*WorkerGroup) SetWorkerHash ¶
func (w *WorkerGroup) SetWorkerHash(workerSize int, hashFn WorkerHashFn)
func (*WorkerGroup) SetWorkerRandHash ¶
func (w *WorkerGroup) SetWorkerRandHash(workerSize int)
func (*WorkerGroup) WorkerMap ¶
func (w *WorkerGroup) WorkerMap() map[int]*Worker
type WorkerHashFn ¶
type WorkerHashFn func(msg interface{}) int
Click to show internal directories.
Click to hide internal directories.