Documentation ¶
Index ¶
- Constants
- Variables
- func EncodeArgs(app cfacade.IApplication, fi *creflect.FuncInfo, index int, m *cfacade.Message) error
- func EncodeLocalArgs(app cfacade.IApplication, fi *creflect.FuncInfo, m *cfacade.Message) error
- func EncodeRemoteArgs(app cfacade.IApplication, fi *creflect.FuncInfo, m *cfacade.Message) error
- func InvokeLocalFunc(app cfacade.IApplication, fi *creflect.FuncInfo, m *cfacade.Message)
- func InvokeRemoteFunc(app cfacade.IApplication, fi *creflect.FuncInfo, m *cfacade.Message)
- type Actor
- func (p *Actor) ActorID() string
- func (p *Actor) App() cfacade.IApplication
- func (p *Actor) Call(targetPath, funcName string, arg interface{}) int32
- func (p *Actor) CallWait(targetPath, funcName string, arg interface{}, reply interface{}) int32
- func (p *Actor) Child() cfacade.IActorChild
- func (p *Actor) Event() IEvent
- func (p *Actor) Exit()
- func (p *Actor) LastAt() int64
- func (p *Actor) Local() IMailBox
- func (p *Actor) Path() *cfacade.ActorPath
- func (p *Actor) PathString() string
- 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() IMailBox
- func (p *Actor) State() State
- func (p *Actor) System() *System
- func (p *Actor) Timer() ITimer
- type Base
- func (p *Base) AliasID() string
- func (p *Base) NewChildPath(actorID, childID interface{}) string
- func (p *Base) NewMyChildPath(childID interface{}) string
- func (p *Base) NewNodePath(actorID interface{}) string
- func (p *Base) NewPath(nodeID, actorID interface{}) string
- func (*Base) OnFindChild(_ *cfacade.Message) (cfacade.IActor, bool)
- func (*Base) OnInit()
- func (*Base) OnLocalReceived(_ *cfacade.Message) (next bool, invoke bool)
- func (*Base) OnRemoteReceived(_ *cfacade.Message) (next bool, invoke bool)
- func (*Base) OnStop()
- type Component
- type IActorLoader
- type IEvent
- type IEventFunc
- type IMailBox
- type ITimer
- type ITimerSchedule
- type State
- type System
- func (p *System) Call(source, target, funcName string, arg interface{}) int32
- func (p *System) CallWait(source, target, funcName string, arg interface{}, reply interface{}) int32
- func (p *System) CreateActor(id string, handler cfacade.IActorHandler) (cfacade.IActor, error)
- func (p *System) GetActor(id string) (*Actor, bool)
- func (p *System) GetChildActor(actorID, childID string) (*Actor, bool)
- func (p *System) GetIActor(id string) (cfacade.IActor, bool)
- func (p *System) NodeId() string
- 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) SetApp(app cfacade.IApplication)
- func (p *System) SetArrivalTimeout(t int64)
- func (p *System) SetCallTimeout(d time.Duration)
- func (p *System) SetExecutionTimeout(t int64)
- func (p *System) SetLocalInvoke(fn cfacade.InvokeFunc)
- func (p *System) SetRemoteInvoke(fn cfacade.InvokeFunc)
- func (p *System) Stop()
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.") )
View Source
var (
Name = "actor_component"
)
Functions ¶
func EncodeArgs ¶ added in v1.3.1
func EncodeLocalArgs ¶ added in v1.3.1
func EncodeRemoteArgs ¶ added in v1.3.1
func InvokeLocalFunc ¶ added in v1.3.1
func InvokeRemoteFunc ¶ added in v1.3.1
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) PathString ¶ added in v1.3.1
func (*Actor) PostEvent ¶
func (p *Actor) PostEvent(data cfacade.IEventData)
func (*Actor) PostRemote ¶
type Base ¶
type Base struct {
Actor
}
func (*Base) NewChildPath ¶ added in v1.3.1
func (*Base) NewMyChildPath ¶ added in v1.3.4
func (*Base) NewNodePath ¶ added in v1.3.4
func (*Base) OnFindChild ¶
OnFindChild 寻找子Actor时触发该函数.开发者可以自定义创建子Actor
func (*Base) OnLocalReceived ¶
OnLocalReceived Actor收到Local消息时触发该函数
func (*Base) OnRemoteReceived ¶
OnRemoteReceived Actor收到Remote消息时触发该函数
type Component ¶ added in v1.3.1
func (*Component) Add ¶ added in v1.3.1
func (c *Component) Add(actors ...cfacade.IActorHandler)
func (*Component) OnAfterInit ¶ added in v1.3.1
func (c *Component) OnAfterInit()
type IActorLoader ¶
type IActorLoader interface {
// contains filtered or unexported methods
}
type IEvent ¶
type IEvent interface { Register(name string, fn IEventFunc) // 注册事件 Registers(names []string, fn IEventFunc) // 注册多个事件 Unregister(name string) // 注销事件 }
type IEventFunc ¶
type IEventFunc func(cfacade.IEventData) // 接收事件数据时的处理函数
type ITimer ¶
type ITimer interface { Add(d time.Duration, fn func(), async ...bool) uint64 // 添加定时器,循环执行 AddOnce(d time.Duration, fn func(), async ...bool) uint64 // 添加定时器,执行一次 AddFixedHour(hour, minute, second int, fn func(), async ...bool) uint64 // 固定x小时x分x秒,循环执行 AddFixedMinute(minute, second int, fn func(), async ...bool) uint64 // 固定x分x秒,循环执行 AddSchedule(s ITimerSchedule, f func(), async ...bool) uint64 // 添加自定义调度 Remove(id uint64) // 移除定时器 RemoveAll() // 移除所有定时器 }
type System ¶
type System struct {
// contains filtered or unexported fields
}
System Actor系统
func (*System) CallWait ¶
func (p *System) CallWait(source, target, funcName string, arg interface{}, reply interface{}) int32
CallWait 发送远程消息(等待回复)
func (*System) CreateActor ¶
CreateActor 创建Actor
func (*System) GetChildActor ¶ added in v1.3.6
func (*System) SetApp ¶ added in v1.3.1
func (p *System) SetApp(app cfacade.IApplication)
func (*System) SetArrivalTimeout ¶ added in v1.3.1
func (*System) SetCallTimeout ¶ added in v1.3.1
func (*System) SetExecutionTimeout ¶ added in v1.3.1
func (*System) SetLocalInvoke ¶
func (p *System) SetLocalInvoke(fn cfacade.InvokeFunc)
func (*System) SetRemoteInvoke ¶
func (p *System) SetRemoteInvoke(fn cfacade.InvokeFunc)
Click to show internal directories.
Click to hide internal directories.