Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompWithOptions ¶
type Component ¶
type Component interface { // Init 初始化组件时调用. Init() // AfterInit 初始化组件后调用. AfterInit() // BeforeShutdown 组件被停止前调用. BeforeShutdown() // Shutdown 停止组件时调用. Shutdown() }
Component 具体组件的接口.
type Components ¶
type Components struct {
// contains filtered or unexported fields
}
func (*Components) List ¶
func (cs *Components) List() []CompWithOptions
List returns all components with it's options
func (*Components) Register ¶
func (cs *Components) Register(c Component, options ...Option)
Register registers a component to hub with options
type Handler ¶
type Handler struct { Receiver reflect.Value // receiver of method Method reflect.Method // method stub Type reflect.Type // arg type of method IsRawArg bool // whether the data need to unserialize }
Handler represents a message.Message's handler's meta information.
type Option ¶
type Option func(options *options)
Option used to customize handler
func WithNameFunc ¶
WithNameFunc override handler name by specific function such as: strings.ToUpper/strings.ToLower
func WithSchedulerName ¶
WithSchedulerName set the name of the service scheduler
type Service ¶
type Service struct { Name string // name of service Type reflect.Type // type of the receiver Receiver reflect.Value // receiver of methods for the service Handlers map[string]*Handler // registered methods SchedulerName string // name of scheduler variable in session data Options options // options }
Service implements a specific service, some of it's methods will be called when the correspond events is occurred.
func NewService ¶
func (*Service) ExtractHandler ¶
ExtractHandler extract the set of methods from the receiver value which satisfy the following conditions: - exported method of exported type - two arguments, both of exported type - the first argument is *session.Session - the second argument is []byte or a pointer