Documentation ¶
Index ¶
- Constants
- func LDebug(l *lua.LState) int
- func LError(l *lua.LState) int
- func LGoVersion(l *lua.LState) int
- func LWarn(l *lua.LState) int
- func New(id string, handler spawnActor, op ...ActorOption) *actor
- func ParseRequestId(requestId string) (sourceId string, targetId string, sourceAddr string, ok bool)
- type Actor
- type ActorOption
- type Base
- type EvClusterUpdate
- type EvDelactor
- type EvNewactor
- type EvSessionclosed
- type EvSessionopened
- type ICmd
- type System
- func (s *System) Address() string
- func (ed System) CancelAll(actorId string)
- func (ed System) CancelEvent(actorId string, events ...interface{}) error
- func (ed System) DispatchEvent(sourceId string, event interface{}) error
- func (s *System) Regist(actor *actor) error
- func (ed System) RegistEvent(actorId string, events ...interface{}) error
- func (s *System) Send(sourceId, targetId, requestId string, msg interface{}) error
- func (s *System) SetCluster(id string)
- func (s *System) Stop()
- type SystemOption
Constants ¶
View Source
const DefaultTimeout = time.Second * 30
Variables ¶
This section is empty.
Functions ¶
func LGoVersion ¶
func New ¶
func New(id string, handler spawnActor, op ...ActorOption) *actor
New 创建actor id actorId外部定义 @和$为内部符号,其他id尽量不占用 handler 消息处理模块 op 修改默认属性
Types ¶
type Actor ¶ added in v1.0.4
type Actor interface { //core ID() string System() *System Exit() //timer AddTimer(timeId string, interval time.Duration, callback func(dt int64), trigger_times ...int32) string CancelTimer(timerId string) //lua CallLua(name string, ret int, args ...lua.LValue) []lua.LValue // Send 不保证消息发送可靠性 Send(targetId string, msg interface{}) error Request(targetId string, msg interface{}, timeout ...time.Duration) (req *request) RequestWait(targetId string, msg interface{}, timeout ...time.Duration) (result interface{}, err error) Response(requestId string, msg interface{}) error //cmd RegistCmd(cmd string, fn func(...string), usage ...string) }
type ActorOption ¶
type ActorOption func(*actor)
func SetLocalized ¶
func SetLocalized() ActorOption
func SetLua ¶
func SetLua(path string) ActorOption
func SetTimerAccuracy ¶
func SetTimerAccuracy(acc int64) ActorOption
type Base ¶
type Base struct {
Actor
}
Base 创建Actor统一通过Base继承
func (*Base) OnHandleEvent ¶
func (s *Base) OnHandleEvent(event interface{})
func (*Base) OnHandleMessage ¶
func (*Base) OnHandleRequest ¶
type EvClusterUpdate ¶ added in v1.0.7
type EvDelactor ¶ added in v1.0.7
type EvNewactor ¶ added in v1.0.7
type EvSessionclosed ¶ added in v1.0.7
type EvSessionclosed struct {
PeerHost string
}
type EvSessionopened ¶ added in v1.0.7
type EvSessionopened struct {
PeerHost string
}
type System ¶
type System struct { CStop chan struct{} // contains filtered or unexported fields }
func NewSystem ¶
func NewSystem(op ...SystemOption) (*System, error)
func (System) CancelEvent ¶
CancelEvent 取消actor事件
func (System) DispatchEvent ¶
DispatchEvent 事件触发
func (System) RegistEvent ¶
RegistEvent 注册actor事件
func (*System) SetCluster ¶
type SystemOption ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.