Documentation
¶
Overview ¶
Package framework Golaxy分布式服务开发框架。
Index ¶
- Variables
- type App
- func (app *App) GetStartupCmd() *cobra.Command
- func (app *App) GetStartupConf() *viper.Viper
- func (app *App) InitCB(cb generic.Action1[*App]) *App
- func (app *App) Run()
- func (app *App) Setup(name string, generic any) *App
- func (app *App) StartingCB(cb generic.Action1[*App]) *App
- func (app *App) TerminateCB(cb generic.Action1[*App]) *App
- type AwaitDirector
- func (ad AwaitDirector) All(fun generic.FuncVar1[[]async.Ret, any, async.Ret], args ...any) async.AsyncRet
- func (ad AwaitDirector) AllVoid(fun generic.ActionVar1[[]async.Ret, any], args ...any) async.AsyncRet
- func (ad AwaitDirector) Any(fun generic.FuncVar1[async.Ret, any, async.Ret], args ...any) async.AsyncRet
- func (ad AwaitDirector) AnyVoid(fun generic.ActionVar1[async.Ret, any], args ...any) async.AsyncRet
- func (ad AwaitDirector) Foreach(fun generic.ActionVar1[async.Ret, any], args ...any) async.AsyncRet
- func (ad AwaitDirector) OK(fun generic.FuncVar1[async.Ret, any, async.Ret], args ...any) async.AsyncRet
- func (ad AwaitDirector) OKVoid(fun generic.ActionVar1[async.Ret, any], args ...any) async.AsyncRet
- func (ad AwaitDirector) Transform(fun generic.FuncVar1[async.Ret, any, async.Ret], args ...any) async.AsyncRet
- type ComponentBehavior
- func (c *ComponentBehavior) Await(asyncRets ...async.AsyncRet) AwaitDirector
- func (c *ComponentBehavior) BalanceOnewayRPC(service, comp, method string, args ...any) error
- func (c *ComponentBehavior) BalanceRPC(service, comp, method string, args ...any) async.AsyncRet
- func (c *ComponentBehavior) BroadcastCliOnewayRPC(proc, method string, args ...any) error
- func (c *ComponentBehavior) BroadcastOnewayRPC(excludeSelf bool, service, comp, method string, args ...any) error
- func (c *ComponentBehavior) CallAsync(fun generic.FuncVar0[any, async.Ret], args ...any) async.AsyncRet
- func (c *ComponentBehavior) CallVoidAsync(fun generic.ActionVar0[any], args ...any) async.AsyncRet
- func (c *ComponentBehavior) CliOnewayRPC(proc, method string, args ...any) error
- func (c *ComponentBehavior) CliRPC(proc, method string, args ...any) async.AsyncRet
- func (c *ComponentBehavior) GetAddInManager() extension.AddInManager
- func (c *ComponentBehavior) GetLiving() bool
- func (c *ComponentBehavior) GetRuntime() IRuntime
- func (c *ComponentBehavior) GetService() IService
- func (c *ComponentBehavior) GlobalBalanceOnewayRPC(excludeSelf bool, comp, method string, args ...any) error
- func (c *ComponentBehavior) GlobalBalanceRPC(excludeSelf bool, comp, method string, args ...any) async.AsyncRet
- func (c *ComponentBehavior) GlobalBroadcastOnewayRPC(excludeSelf bool, comp, method string, args ...any) error
- func (c *ComponentBehavior) GoAsync(fun generic.FuncVar0[any, async.Ret], args ...any) async.AsyncRet
- func (c *ComponentBehavior) GoVoidAsync(fun generic.ActionVar0[any], args ...any) async.AsyncRet
- func (c *ComponentBehavior) OnewayRPC(service, comp, method string, args ...any) error
- func (c *ComponentBehavior) RPC(service, comp, method string, args ...any) async.AsyncRet
- func (c *ComponentBehavior) ReadChanAsync(ch <-chan any) async.AsyncRet
- func (c *ComponentBehavior) TimeAfterAsync(dur time.Duration) async.AsyncRet
- func (c *ComponentBehavior) TimeAtAsync(at time.Time) async.AsyncRet
- func (c *ComponentBehavior) TimeTickAsync(dur time.Duration) async.AsyncRet
- type EntityBehavior
- func (e *EntityBehavior) Await(asyncRets ...async.AsyncRet) AwaitDirector
- func (e *EntityBehavior) BalanceOnewayRPC(service, comp, method string, args ...any) error
- func (e *EntityBehavior) BalanceRPC(service, comp, method string, args ...any) async.AsyncRet
- func (e *EntityBehavior) BroadcastCliOnewayRPC(proc, method string, args ...any) error
- func (e *EntityBehavior) BroadcastOnewayRPC(excludeSelf bool, service, comp, method string, args ...any) error
- func (e *EntityBehavior) CallAsync(fun generic.FuncVar0[any, async.Ret], args ...any) async.AsyncRet
- func (e *EntityBehavior) CallVoidAsync(fun generic.ActionVar0[any], args ...any) async.AsyncRet
- func (e *EntityBehavior) CliOnewayRPC(proc, method string, args ...any) error
- func (e *EntityBehavior) CliRPC(proc, method string, args ...any) async.AsyncRet
- func (e *EntityBehavior) GetAddInManager() extension.AddInManager
- func (e *EntityBehavior) GetLiving() bool
- func (e *EntityBehavior) GetRuntime() IRuntime
- func (e *EntityBehavior) GetService() IService
- func (e *EntityBehavior) GlobalBalanceOnewayRPC(excludeSelf bool, comp, method string, args ...any) error
- func (e *EntityBehavior) GlobalBalanceRPC(excludeSelf bool, comp, method string, args ...any) async.AsyncRet
- func (e *EntityBehavior) GlobalBroadcastOnewayRPC(excludeSelf bool, comp, method string, args ...any) error
- func (e *EntityBehavior) GoAsync(fun generic.FuncVar0[any, async.Ret], args ...any) async.AsyncRet
- func (e *EntityBehavior) GoVoidAsync(fun generic.ActionVar0[any], args ...any) async.AsyncRet
- func (e *EntityBehavior) OnewayRPC(service, comp, method string, args ...any) error
- func (e *EntityBehavior) RPC(service, comp, method string, args ...any) async.AsyncRet
- func (e *EntityBehavior) ReadChanAsync(ch <-chan any) async.AsyncRet
- func (e *EntityBehavior) TimeAfterAsync(dur time.Duration) async.AsyncRet
- func (e *EntityBehavior) TimeAtAsync(at time.Time) async.AsyncRet
- func (e *EntityBehavior) TimeTickAsync(dur time.Duration) async.AsyncRet
- type EntityCreatorAsync
- func (c *EntityCreatorAsync) AssignMeta(m meta.Meta) *EntityCreatorAsync
- func (c *EntityCreatorAsync) MergeMeta(dict map[string]any) *EntityCreatorAsync
- func (c *EntityCreatorAsync) MergeMetaIfAbsent(dict map[string]any) *EntityCreatorAsync
- func (c *EntityCreatorAsync) New() (ec.ConcurrentEntity, error)
- func (c *EntityCreatorAsync) NewAsync() async.AsyncRetT[ec.ConcurrentEntity]
- func (c *EntityCreatorAsync) SetComponentAwakeOnFirstTouch(b bool) *EntityCreatorAsync
- func (c *EntityCreatorAsync) SetComponentNameIndexing(b bool) *EntityCreatorAsync
- func (c *EntityCreatorAsync) SetComponentUniqueID(b bool) *EntityCreatorAsync
- func (c *EntityCreatorAsync) SetInstance(instance ec.Entity) *EntityCreatorAsync
- func (c *EntityCreatorAsync) SetInstanceFace(face iface.Face[ec.Entity]) *EntityCreatorAsync
- func (c *EntityCreatorAsync) SetMeta(dict map[string]any) *EntityCreatorAsync
- func (c *EntityCreatorAsync) SetParentId(id uid.Id) *EntityCreatorAsync
- func (c *EntityCreatorAsync) SetPersistId(id uid.Id) *EntityCreatorAsync
- func (c *EntityCreatorAsync) SetRuntime(rtInst IRuntime) *EntityCreatorAsync
- func (c *EntityCreatorAsync) SetRuntimeCreator(rtCreator *RuntimeCreator) *EntityCreatorAsync
- func (c *EntityCreatorAsync) SetScope(scope ec.Scope) *EntityCreatorAsync
- type EntityPTCreator
- type IRuntime
- type IRuntimeInstantiation
- type IService
- type IServiceInstantiation
- type InstallRuntimeDistEntityRegistry
- type InstallRuntimeLogger
- type InstallRuntimeRPCStack
- type InstallServiceBroker
- type InstallServiceConfig
- type InstallServiceDistEntityQuerier
- type InstallServiceDistService
- type InstallServiceDistSync
- type InstallServiceLogger
- type InstallServiceRPC
- type InstallServiceRegistry
- type LifecycleRuntimeAddInActivated
- type LifecycleRuntimeAddInActivating
- type LifecycleRuntimeAddInDeactivated
- type LifecycleRuntimeAddInDeactivating
- type LifecycleRuntimeBirth
- type LifecycleRuntimeBuilt
- type LifecycleRuntimeFrameLoopBegin
- type LifecycleRuntimeFrameLoopEnd
- type LifecycleRuntimeFrameUpdateBegin
- type LifecycleRuntimeFrameUpdateEnd
- type LifecycleRuntimeRunCallBegin
- type LifecycleRuntimeRunCallEnd
- type LifecycleRuntimeRunGCBegin
- type LifecycleRuntimeRunGCEnd
- type LifecycleRuntimeStarted
- type LifecycleRuntimeStarting
- type LifecycleRuntimeTerminated
- type LifecycleRuntimeTerminating
- type LifecycleServiceAddInActivated
- type LifecycleServiceAddInActivating
- type LifecycleServiceAddInDeactivated
- type LifecycleServiceAddInDeactivating
- type LifecycleServiceBirth
- type LifecycleServiceBuilt
- type LifecycleServiceDefaultConfig
- type LifecycleServiceEntityPTDeclared
- type LifecycleServiceEntityPTRedeclared
- type LifecycleServiceEntityPTUndeclared
- type LifecycleServiceStarted
- type LifecycleServiceStarting
- type LifecycleServiceTerminated
- type LifecycleServiceTerminating
- type RuntimeBehavior
- func (rt *RuntimeBehavior) BuildEntity(prototype string) *core.EntityCreator
- func (rt *RuntimeBehavior) GetAutoInjection() bool
- func (rt *RuntimeBehavior) GetDistEntityRegistry() dentr.IDistEntityRegistry
- func (rt *RuntimeBehavior) GetRPCStack() rpcstack.IRPCStack
- func (rt *RuntimeBehavior) GetService() IService
- type RuntimeCreator
- func (c *RuntimeCreator) New() IRuntime
- func (c *RuntimeCreator) SetAutoInjection(b bool) *RuntimeCreator
- func (c *RuntimeCreator) SetFPS(fps float32) *RuntimeCreator
- func (c *RuntimeCreator) SetName(name string) *RuntimeCreator
- func (c *RuntimeCreator) SetPanicHandling(autoRecover bool, reportError chan error) *RuntimeCreator
- func (c *RuntimeCreator) SetPersistId(id uid.Id) *RuntimeCreator
- func (c *RuntimeCreator) SetProcessQueueCapacity(cap int) *RuntimeCreator
- func (c *RuntimeCreator) Setup(generic any) *RuntimeCreator
- type RuntimeGeneric
- type ServiceBehavior
- func (svc *ServiceBehavior) BuildEntityAsync(prototype string) *EntityCreatorAsync
- func (svc *ServiceBehavior) BuildEntityPT(prototype string) *EntityPTCreator
- func (svc *ServiceBehavior) BuildRuntime() *RuntimeCreator
- func (svc *ServiceBehavior) GetAppConf() *viper.Viper
- func (svc *ServiceBehavior) GetBroker() broker.IBroker
- func (svc *ServiceBehavior) GetDistEntityQuerier() dentq.IDistEntityQuerier
- func (svc *ServiceBehavior) GetDistService() dsvc.IDistService
- func (svc *ServiceBehavior) GetDistSync() dsync.IDistSync
- func (svc *ServiceBehavior) GetMemory() *sync.Map
- func (svc *ServiceBehavior) GetRPC() rpc.IRPC
- func (svc *ServiceBehavior) GetRegistry() discovery.IRegistry
- func (svc *ServiceBehavior) GetServiceConf() *viper.Viper
- func (svc *ServiceBehavior) GetStartupNo() int
- type ServiceGeneric
Constants ¶
This section is empty.
Variables ¶
var BuildEntityPT = core.BuildEntityPT
BuildEntityPT 创建实体原型
var (
ErrEntityOrComponentNotLiving = errors.New("async/await: entity or component not living")
)
var (
ErrFramework = errors.New("framework") // 框架错误
)
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App 应用
func (*App) GetStartupCmd ¶ added in v0.3.44
GetStartupCmd 获取启动命令
type AwaitDirector ¶ added in v0.1.56
type AwaitDirector struct {
// contains filtered or unexported fields
}
AwaitDirector 异步等待分发器
func (AwaitDirector) All ¶ added in v0.1.56
func (ad AwaitDirector) All(fun generic.FuncVar1[[]async.Ret, any, async.Ret], args ...any) async.AsyncRet
All 异步等待所有结果返回,有返回值
func (AwaitDirector) AllVoid ¶ added in v0.3.12
func (ad AwaitDirector) AllVoid(fun generic.ActionVar1[[]async.Ret, any], args ...any) async.AsyncRet
AllVoid 异步等待所有结果返回,无返回值
func (AwaitDirector) Any ¶ added in v0.1.56
func (ad AwaitDirector) Any(fun generic.FuncVar1[async.Ret, any, async.Ret], args ...any) async.AsyncRet
Any 异步等待任意一个结果返回,有返回值
func (AwaitDirector) AnyVoid ¶ added in v0.3.12
func (ad AwaitDirector) AnyVoid(fun generic.ActionVar1[async.Ret, any], args ...any) async.AsyncRet
AnyVoid 异步等待任意一个结果返回,无返回值
func (AwaitDirector) Foreach ¶ added in v0.3.12
func (ad AwaitDirector) Foreach(fun generic.ActionVar1[async.Ret, any], args ...any) async.AsyncRet
Foreach 异步等待产出(yield)返回
func (AwaitDirector) OK ¶ added in v0.3.12
func (ad AwaitDirector) OK(fun generic.FuncVar1[async.Ret, any, async.Ret], args ...any) async.AsyncRet
OK 异步等待任意一个结果成功返回,有返回值
type ComponentBehavior ¶ added in v0.1.56
type ComponentBehavior struct {
ec.ComponentBehavior
}
ComponentBehavior 组件行为,在开发新组件时,匿名嵌入至组件结构体中
func (*ComponentBehavior) Await ¶ added in v0.1.56
func (c *ComponentBehavior) Await(asyncRets ...async.AsyncRet) AwaitDirector
Await 异步等待结果返回
func (*ComponentBehavior) BalanceOnewayRPC ¶ added in v0.2.38
func (c *ComponentBehavior) BalanceOnewayRPC(service, comp, method string, args ...any) error
BalanceOnewayRPC 使用负载均衡模式,向分布式实体目标服务发送单向RPC
func (*ComponentBehavior) BalanceRPC ¶ added in v0.1.56
func (c *ComponentBehavior) BalanceRPC(service, comp, method string, args ...any) async.AsyncRet
BalanceRPC 使用负载均衡模式,向分布式实体目标服务发送RPC
func (*ComponentBehavior) BroadcastCliOnewayRPC ¶ added in v0.2.38
func (c *ComponentBehavior) BroadcastCliOnewayRPC(proc, method string, args ...any) error
BroadcastCliOnewayRPC 向包含实体的所有分组发送单向RPC
func (*ComponentBehavior) BroadcastOnewayRPC ¶ added in v0.2.38
func (c *ComponentBehavior) BroadcastOnewayRPC(excludeSelf bool, service, comp, method string, args ...any) error
BroadcastOnewayRPC 使用广播模式,向分布式实体目标服务发送单向RPC
func (*ComponentBehavior) CallAsync ¶ added in v0.3.5
func (c *ComponentBehavior) CallAsync(fun generic.FuncVar0[any, async.Ret], args ...any) async.AsyncRet
CallAsync 异步执行代码,有返回值
func (*ComponentBehavior) CallVoidAsync ¶ added in v0.3.5
func (c *ComponentBehavior) CallVoidAsync(fun generic.ActionVar0[any], args ...any) async.AsyncRet
CallVoidAsync 异步执行代码,无返回值
func (*ComponentBehavior) CliOnewayRPC ¶ added in v0.2.38
func (c *ComponentBehavior) CliOnewayRPC(proc, method string, args ...any) error
CliOnewayRPC 向客户端发送单向RPC
func (*ComponentBehavior) CliRPC ¶ added in v0.1.56
func (c *ComponentBehavior) CliRPC(proc, method string, args ...any) async.AsyncRet
CliRPC 向客户端发送RPC
func (*ComponentBehavior) GetAddInManager ¶ added in v0.2.81
func (c *ComponentBehavior) GetAddInManager() extension.AddInManager
GetAddInManager 获取插件管理器
func (*ComponentBehavior) GetLiving ¶ added in v0.3.12
func (c *ComponentBehavior) GetLiving() bool
GetLiving 是否活跃可用
func (*ComponentBehavior) GetRuntime ¶ added in v0.1.56
func (c *ComponentBehavior) GetRuntime() IRuntime
GetRuntime 获取运行时
func (*ComponentBehavior) GetService ¶ added in v0.1.56
func (c *ComponentBehavior) GetService() IService
GetService 获取服务
func (*ComponentBehavior) GlobalBalanceOnewayRPC ¶ added in v0.2.38
func (c *ComponentBehavior) GlobalBalanceOnewayRPC(excludeSelf bool, comp, method string, args ...any) error
GlobalBalanceOnewayRPC 使用全局负载均衡模式,向分布式实体任意服务发送单向RPC
func (*ComponentBehavior) GlobalBalanceRPC ¶ added in v0.1.56
func (c *ComponentBehavior) GlobalBalanceRPC(excludeSelf bool, comp, method string, args ...any) async.AsyncRet
GlobalBalanceRPC 使用全局负载均衡模式,向分布式实体任意服务发送RPC
func (*ComponentBehavior) GlobalBroadcastOnewayRPC ¶ added in v0.2.38
func (c *ComponentBehavior) GlobalBroadcastOnewayRPC(excludeSelf bool, comp, method string, args ...any) error
GlobalBroadcastOnewayRPC 使用全局广播模式,向分布式实体所有服务发送单向RPC
func (*ComponentBehavior) GoAsync ¶ added in v0.3.5
func (c *ComponentBehavior) GoAsync(fun generic.FuncVar0[any, async.Ret], args ...any) async.AsyncRet
GoAsync 使用新线程执行代码,有返回值(注意线程安全)
func (*ComponentBehavior) GoVoidAsync ¶ added in v0.3.5
func (c *ComponentBehavior) GoVoidAsync(fun generic.ActionVar0[any], args ...any) async.AsyncRet
GoVoidAsync 使用新线程执行代码,无返回值(注意线程安全)
func (*ComponentBehavior) OnewayRPC ¶ added in v0.2.38
func (c *ComponentBehavior) OnewayRPC(service, comp, method string, args ...any) error
OnewayRPC 向分布式实体目标服务发送单向RPC
func (*ComponentBehavior) RPC ¶ added in v0.1.56
func (c *ComponentBehavior) RPC(service, comp, method string, args ...any) async.AsyncRet
RPC 向分布式实体目标服务发送RPC
func (*ComponentBehavior) ReadChanAsync ¶ added in v0.3.12
func (c *ComponentBehavior) ReadChanAsync(ch <-chan any) async.AsyncRet
ReadChanAsync 读取channel
func (*ComponentBehavior) TimeAfterAsync ¶ added in v0.3.5
func (c *ComponentBehavior) TimeAfterAsync(dur time.Duration) async.AsyncRet
TimeAfterAsync 定时器,指定时长
func (*ComponentBehavior) TimeAtAsync ¶ added in v0.3.5
func (c *ComponentBehavior) TimeAtAsync(at time.Time) async.AsyncRet
TimeAtAsync 定时器,指定时间点
func (*ComponentBehavior) TimeTickAsync ¶ added in v0.3.5
func (c *ComponentBehavior) TimeTickAsync(dur time.Duration) async.AsyncRet
TimeTickAsync 心跳器
type EntityBehavior ¶ added in v0.1.76
type EntityBehavior struct {
ec.EntityBehavior
}
EntityBehavior 实体行为,在需要扩展实体能力时,匿名嵌入至实体结构体中
func (*EntityBehavior) Await ¶ added in v0.1.76
func (e *EntityBehavior) Await(asyncRets ...async.AsyncRet) AwaitDirector
Await 异步等待结果返回
func (*EntityBehavior) BalanceOnewayRPC ¶ added in v0.2.38
func (e *EntityBehavior) BalanceOnewayRPC(service, comp, method string, args ...any) error
BalanceOnewayRPC 使用负载均衡模式,向分布式实体目标服务发送单向RPC
func (*EntityBehavior) BalanceRPC ¶ added in v0.1.76
func (e *EntityBehavior) BalanceRPC(service, comp, method string, args ...any) async.AsyncRet
BalanceRPC 使用负载均衡模式,向分布式实体目标服务发送RPC
func (*EntityBehavior) BroadcastCliOnewayRPC ¶ added in v0.2.38
func (e *EntityBehavior) BroadcastCliOnewayRPC(proc, method string, args ...any) error
BroadcastCliOnewayRPC 向包含实体的所有分组发送单向RPC
func (*EntityBehavior) BroadcastOnewayRPC ¶ added in v0.2.38
func (e *EntityBehavior) BroadcastOnewayRPC(excludeSelf bool, service, comp, method string, args ...any) error
BroadcastOnewayRPC 使用广播模式,向分布式实体目标服务发送单向RPC
func (*EntityBehavior) CallAsync ¶ added in v0.3.5
func (e *EntityBehavior) CallAsync(fun generic.FuncVar0[any, async.Ret], args ...any) async.AsyncRet
CallAsync 异步执行代码,有返回值
func (*EntityBehavior) CallVoidAsync ¶ added in v0.3.5
func (e *EntityBehavior) CallVoidAsync(fun generic.ActionVar0[any], args ...any) async.AsyncRet
CallVoidAsync 异步执行代码,无返回值
func (*EntityBehavior) CliOnewayRPC ¶ added in v0.2.38
func (e *EntityBehavior) CliOnewayRPC(proc, method string, args ...any) error
CliOnewayRPC 向客户端发送单向RPC
func (*EntityBehavior) CliRPC ¶ added in v0.1.76
func (e *EntityBehavior) CliRPC(proc, method string, args ...any) async.AsyncRet
CliRPC 向客户端发送RPC
func (*EntityBehavior) GetAddInManager ¶ added in v0.2.81
func (e *EntityBehavior) GetAddInManager() extension.AddInManager
GetAddInManager 获取插件管理器
func (*EntityBehavior) GetLiving ¶ added in v0.3.12
func (e *EntityBehavior) GetLiving() bool
GetLiving 是否活跃可用
func (*EntityBehavior) GetRuntime ¶ added in v0.1.76
func (e *EntityBehavior) GetRuntime() IRuntime
GetRuntime 获取运行时
func (*EntityBehavior) GetService ¶ added in v0.1.76
func (e *EntityBehavior) GetService() IService
GetService 获取服务
func (*EntityBehavior) GlobalBalanceOnewayRPC ¶ added in v0.2.38
func (e *EntityBehavior) GlobalBalanceOnewayRPC(excludeSelf bool, comp, method string, args ...any) error
GlobalBalanceOnewayRPC 使用全局负载均衡模式,向分布式实体任意服务发送单向RPC
func (*EntityBehavior) GlobalBalanceRPC ¶ added in v0.1.76
func (e *EntityBehavior) GlobalBalanceRPC(excludeSelf bool, comp, method string, args ...any) async.AsyncRet
GlobalBalanceRPC 使用全局负载均衡模式,向分布式实体任意服务发送RPC
func (*EntityBehavior) GlobalBroadcastOnewayRPC ¶ added in v0.2.38
func (e *EntityBehavior) GlobalBroadcastOnewayRPC(excludeSelf bool, comp, method string, args ...any) error
GlobalBroadcastOnewayRPC 使用全局广播模式,向分布式实体所有服务发送单向RPC
func (*EntityBehavior) GoVoidAsync ¶ added in v0.3.5
func (e *EntityBehavior) GoVoidAsync(fun generic.ActionVar0[any], args ...any) async.AsyncRet
GoVoidAsync 使用新线程执行代码,无返回值(注意线程安全)
func (*EntityBehavior) OnewayRPC ¶ added in v0.2.38
func (e *EntityBehavior) OnewayRPC(service, comp, method string, args ...any) error
OnewayRPC 向分布式实体目标服务发送单向RPC
func (*EntityBehavior) RPC ¶ added in v0.1.76
func (e *EntityBehavior) RPC(service, comp, method string, args ...any) async.AsyncRet
RPC 向分布式实体目标服务发送RPC
func (*EntityBehavior) ReadChanAsync ¶ added in v0.3.12
func (e *EntityBehavior) ReadChanAsync(ch <-chan any) async.AsyncRet
ReadChanAsync 读取channel
func (*EntityBehavior) TimeAfterAsync ¶ added in v0.3.5
func (e *EntityBehavior) TimeAfterAsync(dur time.Duration) async.AsyncRet
TimeAfterAsync 定时器,指定时长
func (*EntityBehavior) TimeAtAsync ¶ added in v0.3.5
func (e *EntityBehavior) TimeAtAsync(at time.Time) async.AsyncRet
TimeAtAsync 定时器,指定时间点
func (*EntityBehavior) TimeTickAsync ¶ added in v0.3.5
func (e *EntityBehavior) TimeTickAsync(dur time.Duration) async.AsyncRet
TimeTickAsync 心跳器
type EntityCreatorAsync ¶ added in v0.3.2
type EntityCreatorAsync struct {
// contains filtered or unexported fields
}
EntityCreatorAsync 实体构建器
func BuildEntityAsync ¶ added in v0.3.12
func BuildEntityAsync(svcCtx service.Context, prototype string) *EntityCreatorAsync
BuildEntityAsync 创建实体
func (*EntityCreatorAsync) AssignMeta ¶ added in v0.3.35
func (c *EntityCreatorAsync) AssignMeta(m meta.Meta) *EntityCreatorAsync
AssignMeta 赋值Meta信息
func (*EntityCreatorAsync) MergeMeta ¶ added in v0.3.35
func (c *EntityCreatorAsync) MergeMeta(dict map[string]any) *EntityCreatorAsync
MergeMeta 合并Meta信息,如果存在则覆盖
func (*EntityCreatorAsync) MergeMetaIfAbsent ¶ added in v0.3.35
func (c *EntityCreatorAsync) MergeMetaIfAbsent(dict map[string]any) *EntityCreatorAsync
MergeMetaIfAbsent 合并Meta信息,如果存在则跳过
func (*EntityCreatorAsync) New ¶ added in v0.3.12
func (c *EntityCreatorAsync) New() (ec.ConcurrentEntity, error)
New 创建实体
func (*EntityCreatorAsync) NewAsync ¶ added in v0.3.12
func (c *EntityCreatorAsync) NewAsync() async.AsyncRetT[ec.ConcurrentEntity]
NewAsync 创建实体
func (*EntityCreatorAsync) SetComponentAwakeOnFirstTouch ¶ added in v0.3.12
func (c *EntityCreatorAsync) SetComponentAwakeOnFirstTouch(b bool) *EntityCreatorAsync
SetComponentAwakeOnFirstTouch 设置开启组件被首次访问时,检测并调用Awake()
func (*EntityCreatorAsync) SetComponentNameIndexing ¶ added in v0.3.12
func (c *EntityCreatorAsync) SetComponentNameIndexing(b bool) *EntityCreatorAsync
SetComponentNameIndexing 设置是否开启组件名称索引
func (*EntityCreatorAsync) SetComponentUniqueID ¶ added in v0.3.12
func (c *EntityCreatorAsync) SetComponentUniqueID(b bool) *EntityCreatorAsync
SetComponentUniqueID 设置开启组件唯一Id
func (*EntityCreatorAsync) SetInstance ¶ added in v0.3.12
func (c *EntityCreatorAsync) SetInstance(instance ec.Entity) *EntityCreatorAsync
SetInstance 设置实例,用于扩展实体能力
func (*EntityCreatorAsync) SetInstanceFace ¶ added in v0.3.12
func (c *EntityCreatorAsync) SetInstanceFace(face iface.Face[ec.Entity]) *EntityCreatorAsync
SetInstanceFace 设置实例,用于扩展实体能力
func (*EntityCreatorAsync) SetMeta ¶ added in v0.3.12
func (c *EntityCreatorAsync) SetMeta(dict map[string]any) *EntityCreatorAsync
SetMeta 设置Meta信息
func (*EntityCreatorAsync) SetParentId ¶ added in v0.3.12
func (c *EntityCreatorAsync) SetParentId(id uid.Id) *EntityCreatorAsync
SetParentId 设置父实体Id
func (*EntityCreatorAsync) SetPersistId ¶ added in v0.3.12
func (c *EntityCreatorAsync) SetPersistId(id uid.Id) *EntityCreatorAsync
SetPersistId 设置实体持久化Id
func (*EntityCreatorAsync) SetRuntime ¶ added in v0.3.12
func (c *EntityCreatorAsync) SetRuntime(rtInst IRuntime) *EntityCreatorAsync
SetRuntime 设置运行时(优先使用)
func (*EntityCreatorAsync) SetRuntimeCreator ¶ added in v0.3.12
func (c *EntityCreatorAsync) SetRuntimeCreator(rtCreator *RuntimeCreator) *EntityCreatorAsync
SetRuntimeCreator 设置运行时构建器
func (*EntityCreatorAsync) SetScope ¶ added in v0.3.12
func (c *EntityCreatorAsync) SetScope(scope ec.Scope) *EntityCreatorAsync
SetScope 设置实体的可访问作用域
type EntityPTCreator ¶ added in v0.1.77
type EntityPTCreator = core.EntityPTCreator
EntityPTCreator 实体原型构建器
type IRuntime ¶ added in v0.3.24
type IRuntime interface { runtime.Context // GetDistEntityRegistry 获取分布式实体注册支持 GetDistEntityRegistry() dentr.IDistEntityRegistry // GetRPCStack 获取RPC调用堆栈支持 GetRPCStack() rpcstack.IRPCStack // GetService 获取服务实例 GetService() IService // GetAutoInjection 是否自动注入组件 GetAutoInjection() bool // BuildEntity 创建实体 BuildEntity(prototype string) *core.EntityCreator }
IRuntime 运行时实例接口
func GetRuntime ¶ added in v0.3.24
func GetRuntime(provider runtime.CurrentContextProvider) IRuntime
GetRuntime 获取运行时实例
type IRuntimeInstantiation ¶ added in v0.1.45
type IRuntimeInstantiation interface {
Instantiate() IRuntime
}
IRuntimeInstantiation 运行时实例化接口
type IService ¶ added in v0.3.24
type IService interface { service.Context // GetAppConf 获取当前应用程序配置 GetAppConf() *viper.Viper // GetServiceConf 获取当前服务配置 GetServiceConf() *viper.Viper // GetRegistry 获取服务发现插件 GetRegistry() discovery.IRegistry // GetBroker 获取消息队列中间件插件 GetBroker() broker.IBroker // GetDistSync 获取分布式同步插件 GetDistSync() dsync.IDistSync // GetDistService 获取分布式服务插件 GetDistService() dsvc.IDistService // GetDistEntityQuerier 获取分布式实体查询插件 GetDistEntityQuerier() dentq.IDistEntityQuerier // GetRPC 获取RPC支持插件 GetRPC() rpc.IRPC // GetStartupNo 获取启动序号 GetStartupNo() int // GetMemory 获取服务内存KV存储 GetMemory() *sync.Map // BuildRuntime 创建运行时 BuildRuntime() *RuntimeCreator // BuildEntityPT 创建实体原型 BuildEntityPT(prototype string) *EntityPTCreator // BuildEntityAsync 创建实体 BuildEntityAsync(prototype string) *EntityCreatorAsync }
IService 服务实例接口
func GetService ¶ added in v0.3.24
func GetService(provider runtime.ConcurrentContextProvider) IService
GetService 获取服务实例
type IServiceInstantiation ¶ added in v0.1.45
type IServiceInstantiation interface {
Instantiate() IService
}
IServiceInstantiation 服务实例化接口
type InstallRuntimeDistEntityRegistry ¶ added in v0.1.87
type InstallRuntimeDistEntityRegistry interface {
InstallDistEntityRegistry(rt IRuntime)
}
type InstallRuntimeLogger ¶
type InstallRuntimeLogger interface {
InstallLogger(rt IRuntime)
}
type InstallRuntimeRPCStack ¶ added in v0.1.69
type InstallRuntimeRPCStack interface {
InstallRPCStack(rt IRuntime)
}
type InstallServiceBroker ¶
type InstallServiceBroker interface {
InstallBroker(svc IService)
}
type InstallServiceConfig ¶
type InstallServiceConfig interface {
InstallConfig(svc IService)
}
type InstallServiceDistEntityQuerier ¶
type InstallServiceDistEntityQuerier interface {
InstallDistEntityQuerier(svc IService)
}
type InstallServiceDistService ¶
type InstallServiceDistService interface {
InstallDistService(svc IService)
}
type InstallServiceDistSync ¶
type InstallServiceDistSync interface {
InstallDistSync(svc IService)
}
type InstallServiceLogger ¶
type InstallServiceLogger interface {
InstallLogger(svc IService)
}
type InstallServiceRPC ¶
type InstallServiceRPC interface {
InstallRPC(svc IService)
}
type InstallServiceRegistry ¶
type InstallServiceRegistry interface {
InstallRegistry(svc IService)
}
type LifecycleRuntimeAddInActivated ¶ added in v0.2.85
type LifecycleRuntimeAddInActivated interface {
AddInActivated(rt IRuntime, addIn extension.AddInStatus)
}
type LifecycleRuntimeAddInActivating ¶ added in v0.2.85
type LifecycleRuntimeAddInActivating interface {
AddInActivating(rt IRuntime, addIn extension.AddInStatus)
}
type LifecycleRuntimeAddInDeactivated ¶ added in v0.2.85
type LifecycleRuntimeAddInDeactivated interface {
AddInDeactivated(rt IRuntime, addIn extension.AddInStatus)
}
type LifecycleRuntimeAddInDeactivating ¶ added in v0.2.85
type LifecycleRuntimeAddInDeactivating interface {
AddInDeactivating(rt IRuntime, addIn extension.AddInStatus)
}
type LifecycleRuntimeBirth ¶
type LifecycleRuntimeBirth interface {
Birth(rt IRuntime)
}
type LifecycleRuntimeBuilt ¶ added in v0.1.45
type LifecycleRuntimeBuilt interface {
Built(rt IRuntime)
}
type LifecycleRuntimeFrameLoopBegin ¶
type LifecycleRuntimeFrameLoopBegin interface {
FrameLoopBegin(rt IRuntime)
}
type LifecycleRuntimeFrameLoopEnd ¶
type LifecycleRuntimeFrameLoopEnd interface {
FrameLoopEnd(rt IRuntime)
}
type LifecycleRuntimeFrameUpdateBegin ¶
type LifecycleRuntimeFrameUpdateBegin interface {
FrameUpdateBegin(rt IRuntime)
}
type LifecycleRuntimeFrameUpdateEnd ¶
type LifecycleRuntimeFrameUpdateEnd interface {
FrameUpdateEnd(rt IRuntime)
}
type LifecycleRuntimeRunCallBegin ¶
type LifecycleRuntimeRunCallBegin interface {
RunCallBegin(rt IRuntime)
}
type LifecycleRuntimeRunCallEnd ¶
type LifecycleRuntimeRunCallEnd interface {
RunCallEnd(rt IRuntime)
}
type LifecycleRuntimeRunGCBegin ¶
type LifecycleRuntimeRunGCBegin interface {
RunGCBegin(rt IRuntime)
}
type LifecycleRuntimeRunGCEnd ¶
type LifecycleRuntimeRunGCEnd interface {
RunGCEnd(rt IRuntime)
}
type LifecycleRuntimeStarted ¶
type LifecycleRuntimeStarted interface {
Started(rt IRuntime)
}
type LifecycleRuntimeStarting ¶
type LifecycleRuntimeStarting interface {
Starting(rt IRuntime)
}
type LifecycleRuntimeTerminated ¶
type LifecycleRuntimeTerminated interface {
Terminated(rt IRuntime)
}
type LifecycleRuntimeTerminating ¶
type LifecycleRuntimeTerminating interface {
Terminating(rt IRuntime)
}
type LifecycleServiceAddInActivated ¶ added in v0.2.85
type LifecycleServiceAddInActivated interface {
AddInActivated(svc IService, addIn extension.AddInStatus)
}
type LifecycleServiceAddInActivating ¶ added in v0.2.85
type LifecycleServiceAddInActivating interface {
AddInActivating(svc IService, addIn extension.AddInStatus)
}
type LifecycleServiceAddInDeactivated ¶ added in v0.2.85
type LifecycleServiceAddInDeactivated interface {
AddInDeactivated(svc IService, addIn extension.AddInStatus)
}
type LifecycleServiceAddInDeactivating ¶ added in v0.2.85
type LifecycleServiceAddInDeactivating interface {
AddInDeactivating(svc IService, addIn extension.AddInStatus)
}
type LifecycleServiceBirth ¶
type LifecycleServiceBirth interface {
Birth(svc IService)
}
type LifecycleServiceBuilt ¶ added in v0.1.45
type LifecycleServiceBuilt interface {
Built(svc IService)
}
type LifecycleServiceDefaultConfig ¶ added in v0.3.44
type LifecycleServiceEntityPTDeclared ¶ added in v0.2.85
type LifecycleServiceEntityPTRedeclared ¶ added in v0.2.85
type LifecycleServiceEntityPTUndeclared ¶ added in v0.2.85
type LifecycleServiceStarted ¶
type LifecycleServiceStarted interface {
Started(svc IService)
}
type LifecycleServiceStarting ¶
type LifecycleServiceStarting interface {
Starting(svc IService)
}
type LifecycleServiceTerminated ¶
type LifecycleServiceTerminated interface {
Terminated(svc IService)
}
type LifecycleServiceTerminating ¶
type LifecycleServiceTerminating interface {
Terminating(svc IService)
}
type RuntimeBehavior ¶
type RuntimeBehavior struct { runtime.ContextBehavior // contains filtered or unexported fields }
RuntimeBehavior 运行时实例行为
func (*RuntimeBehavior) BuildEntity ¶ added in v0.3.53
func (rt *RuntimeBehavior) BuildEntity(prototype string) *core.EntityCreator
BuildEntity 创建实体
func (*RuntimeBehavior) GetAutoInjection ¶ added in v0.3.53
func (rt *RuntimeBehavior) GetAutoInjection() bool
GetAutoInjection 是否自动注入组件
func (*RuntimeBehavior) GetDistEntityRegistry ¶ added in v0.3.53
func (rt *RuntimeBehavior) GetDistEntityRegistry() dentr.IDistEntityRegistry
GetDistEntityRegistry 获取分布式实体注册支持
func (*RuntimeBehavior) GetRPCStack ¶ added in v0.3.53
func (rt *RuntimeBehavior) GetRPCStack() rpcstack.IRPCStack
GetRPCStack 获取RPC调用堆栈支持
func (*RuntimeBehavior) GetService ¶ added in v0.3.53
func (rt *RuntimeBehavior) GetService() IService
GetService 获取服务
type RuntimeCreator ¶
type RuntimeCreator struct {
// contains filtered or unexported fields
}
RuntimeCreator 运行时构建器
func BuildRuntime ¶ added in v0.3.12
func BuildRuntime(svcCtx service.Context) *RuntimeCreator
BuildRuntime 创建运行时
func (*RuntimeCreator) SetAutoInjection ¶ added in v0.3.24
func (c *RuntimeCreator) SetAutoInjection(b bool) *RuntimeCreator
SetAutoInjection 设置是否自动注入依赖的组件
func (*RuntimeCreator) SetFPS ¶ added in v0.3.12
func (c *RuntimeCreator) SetFPS(fps float32) *RuntimeCreator
SetFPS 设置帧率
func (*RuntimeCreator) SetName ¶ added in v0.3.12
func (c *RuntimeCreator) SetName(name string) *RuntimeCreator
SetName 设置名称
func (*RuntimeCreator) SetPanicHandling ¶ added in v0.3.12
func (c *RuntimeCreator) SetPanicHandling(autoRecover bool, reportError chan error) *RuntimeCreator
SetPanicHandling 设置panic时的处理方式
func (*RuntimeCreator) SetPersistId ¶ added in v0.3.12
func (c *RuntimeCreator) SetPersistId(id uid.Id) *RuntimeCreator
SetPersistId 设置持久化Id
func (*RuntimeCreator) SetProcessQueueCapacity ¶ added in v0.3.12
func (c *RuntimeCreator) SetProcessQueueCapacity(cap int) *RuntimeCreator
SetProcessQueueCapacity 设置任务处理流水线大小
func (*RuntimeCreator) Setup ¶
func (c *RuntimeCreator) Setup(generic any) *RuntimeCreator
Setup 安装运行时泛化类型
type RuntimeGeneric ¶ added in v0.1.37
type RuntimeGeneric struct {
// contains filtered or unexported fields
}
RuntimeGeneric 运行时泛化类型
func (*RuntimeGeneric) GetService ¶ added in v0.1.87
func (r *RuntimeGeneric) GetService() IService
GetService 获取服务
type ServiceBehavior ¶
type ServiceBehavior struct { service.ContextBehavior // contains filtered or unexported fields }
ServiceBehavior 服务实例行为
func (*ServiceBehavior) BuildEntityAsync ¶ added in v0.3.53
func (svc *ServiceBehavior) BuildEntityAsync(prototype string) *EntityCreatorAsync
BuildEntityAsync 创建实体
func (*ServiceBehavior) BuildEntityPT ¶ added in v0.3.53
func (svc *ServiceBehavior) BuildEntityPT(prototype string) *EntityPTCreator
BuildEntityPT 创建实体原型
func (*ServiceBehavior) BuildRuntime ¶ added in v0.3.53
func (svc *ServiceBehavior) BuildRuntime() *RuntimeCreator
BuildRuntime 创建运行时
func (*ServiceBehavior) GetAppConf ¶ added in v0.3.53
func (svc *ServiceBehavior) GetAppConf() *viper.Viper
GetAppConf 获取当前应用程序配置
func (*ServiceBehavior) GetBroker ¶ added in v0.3.53
func (svc *ServiceBehavior) GetBroker() broker.IBroker
GetBroker 获取消息队列中间件插件
func (*ServiceBehavior) GetDistEntityQuerier ¶ added in v0.3.53
func (svc *ServiceBehavior) GetDistEntityQuerier() dentq.IDistEntityQuerier
GetDistEntityQuerier 获取分布式实体查询插件
func (*ServiceBehavior) GetDistService ¶ added in v0.3.53
func (svc *ServiceBehavior) GetDistService() dsvc.IDistService
GetDistService 获取分布式服务插件
func (*ServiceBehavior) GetDistSync ¶ added in v0.3.53
func (svc *ServiceBehavior) GetDistSync() dsync.IDistSync
GetDistSync 获取分布式同步插件
func (*ServiceBehavior) GetMemory ¶ added in v0.3.53
func (svc *ServiceBehavior) GetMemory() *sync.Map
GetMemory 获取服务内存KV存储
func (*ServiceBehavior) GetRPC ¶ added in v0.3.53
func (svc *ServiceBehavior) GetRPC() rpc.IRPC
GetRPC 获取RPC支持插件
func (*ServiceBehavior) GetRegistry ¶ added in v0.3.53
func (svc *ServiceBehavior) GetRegistry() discovery.IRegistry
GetRegistry 获取服务发现插件
func (*ServiceBehavior) GetServiceConf ¶ added in v0.3.53
func (svc *ServiceBehavior) GetServiceConf() *viper.Viper
GetServiceConf 获取当前服务配置
func (*ServiceBehavior) GetStartupNo ¶ added in v0.3.53
func (svc *ServiceBehavior) GetStartupNo() int
GetStartupNo 获取启动序号
type ServiceGeneric ¶ added in v0.1.37
type ServiceGeneric struct {
// contains filtered or unexported fields
}
ServiceGeneric 服务泛化类型
func (*ServiceGeneric) GetName ¶ added in v0.1.37
func (s *ServiceGeneric) GetName() string
GetName 获取服务名称
func (*ServiceGeneric) GetStartupCmd ¶ added in v0.3.44
func (s *ServiceGeneric) GetStartupCmd() *cobra.Command
GetStartupCmd 获取启动命令
func (*ServiceGeneric) GetStartupConf ¶ added in v0.1.37
func (s *ServiceGeneric) GetStartupConf() *viper.Viper
GetStartupConf 获取启动参数配置
Source Files
¶
- app.go
- cachecp.go
- comp.go
- comp_async.go
- comp_await.go
- comp_rpc.go
- doc.go
- ec.go
- ec_await.go
- entity.go
- entity_async.go
- entity_await.go
- entity_rpc.go
- entitycreator.go
- entityptcreator.go
- errors.go
- runtime.go
- runtime_addin.go
- runtime_generic.go
- runtime_instantiation.go
- runtime_lifecycle.go
- runtimecreator.go
- service.go
- service_addin.go
- service_generic.go
- service_instantiation.go
- service_lifecycle.go
Directories
¶
Path | Synopsis |
---|---|
addins
|
|
net
|
|
gap
Package gap Golaxy应用层协议(Golaxy Application Protocol),适用于开发应用层通信消息,需要工作在GTP协议或MQ之上,支持消息判重、自定义消息、自定义可变类型等特性。
|
Package gap Golaxy应用层协议(Golaxy Application Protocol),适用于开发应用层通信消息,需要工作在GTP协议或MQ之上,支持消息判重、自定义消息、自定义可变类型等特性。 |
gtp
Package gtp Golaxy传输层协议(Golaxy Transfer Protocol),适用于长连接、实时通信的工作场景,需要工作在可靠网络协议(TCP/WebSocket)之上,支持链路加密、链路鉴权、断线续连等特性。
|
Package gtp Golaxy传输层协议(Golaxy Transfer Protocol),适用于长连接、实时通信的工作场景,需要工作在可靠网络协议(TCP/WebSocket)之上,支持链路加密、链路鉴权、断线续连等特性。 |
utils
|
|