Documentation
¶
Index ¶
- Constants
- Variables
- type Actor
- func (p *Actor) ActorID() string
- func (p *Actor) App() cfacade.IApplication
- func (p *Actor) Call(targetPath, funcName string, arg interface{}) error
- func (p *Actor) CallWait(targetPath, funcName string, arg interface{}, reply interface{}) error
- func (p *Actor) Child() cfacade.IActorChild
- func (p *Actor) Event() IEvent
- func (p *Actor) Exit()
- func (p *Actor) Local() *mailbox
- func (p *Actor) Path() *cfacade.ActorPath
- func (p *Actor) PostEvent(data cfacade.IEventData)
- func (p *Actor) PostLocal(m *cfacade.Message)
- func (p *Actor) PostRemote(m *cfacade.Message)
- func (p *Actor) Remote() *mailbox
- func (p *Actor) State() State
- func (p *Actor) System() *System
- func (p *Actor) Timer() ITimer
- type Base
- type IActorLoader
- type IEvent
- type IEventFunc
- type IMailBox
- type ITask
- type ITimer
- type State
- type System
- func (p *System) Call(source, target, funcName string, arg interface{}) error
- func (p *System) CallWait(source, target, funcName string, arg interface{}, reply interface{}) error
- func (p *System) CreateActor(id string, handler cfacade.IActorHandler) (cfacade.IActor, error)
- func (p *System) GetActor(id string) (*Actor, bool)
- func (p *System) GetIActor(id string) (cfacade.IActor, bool)
- func (p *System) NodeId() string
- func (p *System) OnStop()
- func (p *System) PostEvent(data cfacade.IEventData)
- func (p *System) PostLocal(m *cfacade.Message) bool
- func (p *System) PostRemote(m *cfacade.Message) bool
- func (p *System) SetLocalInvoke(fn cfacade.InvokeFunc)
- func (p *System) SetRemoteInvoke(fn cfacade.InvokeFunc)
- func (p *System) SetTellTimeout(d time.Duration)
Constants ¶
View Source
const ( LocalName = "local" RemoteName = "remote" )
Variables ¶
View Source
var ( ErrForbiddenToCallSelf = cerror.Errorf("SendActorID cannot be equal to TargetActorID") ErrForbiddenCreateChildActor = cerror.Errorf("Forbidden create child actor") ErrActorIDIsNil = cerror.Error("actorID is nil.") ErrNotChildActorID = cerror.Error("Not child actorID") ErrActorPathTell = cerror.Error("Target Path tell error.") )
Functions ¶
This section is empty.
Types ¶
type Actor ¶
type Actor struct {
// contains filtered or unexported fields
}
func (*Actor) App ¶
func (p *Actor) App() cfacade.IApplication
func (*Actor) Child ¶
func (p *Actor) Child() cfacade.IActorChild
func (*Actor) PostEvent ¶
func (p *Actor) PostEvent(data cfacade.IEventData)
func (*Actor) PostRemote ¶
type Base ¶
type Base struct {
Actor
}
func (*Base) OnFindChild ¶
OnFindChild 寻找子Actor时触发该函数.开发者可以自定义创建子Actor
func (*Base) OnLocalReceived ¶
OnLocalReceived Actor收到Local消息时触发该函数
func (*Base) OnRemoteReceived ¶
OnRemoteReceived Actor收到Remote消息时触发该函数
type IActorLoader ¶
type IActorLoader interface {
// contains filtered or unexported methods
}
type IEvent ¶
type IEvent interface {
Register(name string, fn IEventFunc) // 注册事件
Unregister(name string) // 注销事件
}
type IEventFunc ¶
type IEventFunc func(cfacade.IEventData) // 接收事件数据时的处理函数
type ITimer ¶
type ITimer interface {
Add(cmd func(dt time.Duration), endAt time.Time, count ...int) (id string) // 根据结束时间添加定时器
AddEveryDay(cmd func(dt time.Duration), hour, minutes, seconds int) (id string) // 添加每天定时器
AddEveryHour(cmd func(dt time.Duration), minutes, seconds int) (id string) // 添加每小时定时器
AddDuration(cmd func(dt time.Duration), duration time.Duration) (id string) // 根据指定的时间截添加定时器
Remove(id string) // 移除定时器
}
type System ¶
type System struct {
// contains filtered or unexported fields
}
System Actor系统
func NewSystem ¶
func NewSystem(app cfacade.IApplication) *System
func (*System) CallWait ¶
func (p *System) CallWait(source, target, funcName string, arg interface{}, reply interface{}) error
CallWait 发送远程消息(等待回复)
func (*System) CreateActor ¶
CreateActor 创建Actor
func (*System) SetLocalInvoke ¶
func (p *System) SetLocalInvoke(fn cfacade.InvokeFunc)
func (*System) SetRemoteInvoke ¶
func (p *System) SetRemoteInvoke(fn cfacade.InvokeFunc)
func (*System) SetTellTimeout ¶
Click to show internal directories.
Click to hide internal directories.