Documentation ¶
Index ¶
- Variables
- func ReadChan[T any](cb *ComponentBehavior, ch <-chan T) runtime.AsyncRet
- type AwaitDirector
- func (ad AwaitDirector) All(fun generic.ActionVar1[[]runtime.Ret, any], va ...any)
- func (ad AwaitDirector) Any(fun generic.ActionVar1[runtime.Ret, any], va ...any)
- func (ad AwaitDirector) AnyOK(fun generic.ActionVar1[runtime.Ret, any], va ...any)
- func (ad AwaitDirector) Pipe(ctx context.Context, fun generic.ActionVar1[runtime.Ret, any], va ...any)
- type ComponentBehavior
- func (c *ComponentBehavior) Async(fun generic.FuncVar0[any, runtime.Ret], va ...any) runtime.AsyncRet
- func (c *ComponentBehavior) AsyncVoid(fun generic.ActionVar0[any], va ...any) runtime.AsyncRet
- func (c *ComponentBehavior) Await(asyncRet ...runtime.AsyncRet) AwaitDirector
- func (c *ComponentBehavior) BalanceOneWayRPC(service, comp, method string, args ...any) error
- func (c *ComponentBehavior) BalanceRPC(service, comp, method string, args ...any) runtime.AsyncRet
- func (c *ComponentBehavior) BroadcastOneWayRPC(service, comp, method string, args ...any) error
- func (c *ComponentBehavior) CliRPC(method string, args ...any) runtime.AsyncRet
- func (c *ComponentBehavior) CliRPCToEntity(entityId uid.Id, method string, args ...any) runtime.AsyncRet
- func (c *ComponentBehavior) GetRuntimeCtx() RuntimeCtx
- func (c *ComponentBehavior) GetServiceCtx() ServiceCtx
- func (c *ComponentBehavior) GlobalBalanceOneWayRPC(comp, method string, args ...any) error
- func (c *ComponentBehavior) GlobalBalanceRPC(comp, method string, args ...any) runtime.AsyncRet
- func (c *ComponentBehavior) GlobalBroadcastOneWayRPC(comp, method string, args ...any) error
- func (c *ComponentBehavior) Go(fun generic.FuncVar0[any, runtime.Ret], va ...any) runtime.AsyncRet
- func (c *ComponentBehavior) GoVoid(fun generic.ActionVar0[any], va ...any) runtime.AsyncRet
- func (c *ComponentBehavior) OneWayCliRPC(method string, args ...any) error
- func (c *ComponentBehavior) OneWayCliRPCToEntity(entityId uid.Id, method string, args ...any) error
- func (c *ComponentBehavior) OneWayRPC(service, comp, method string, args ...any) error
- func (c *ComponentBehavior) RPC(service, comp, method string, args ...any) runtime.AsyncRet
- func (c *ComponentBehavior) TimeAfter(dur time.Duration) runtime.AsyncRet
- func (c *ComponentBehavior) TimeAt(at time.Time) runtime.AsyncRet
- func (c *ComponentBehavior) TimeTick(dur time.Duration) runtime.AsyncRet
- type RuntimeCtx
- type ServiceCtx
- func (ctx ServiceCtx) CreateEntityPT() core.EntityPTCreator
- func (ctx ServiceCtx) CreateRuntime() framework.RuntimeCreator
- func (ctx ServiceCtx) GetBroker() broker.IBroker
- func (ctx ServiceCtx) GetConf() conf.IVisitConf
- func (ctx ServiceCtx) GetDistEntityQuerier() dentq.IDistEntityQuerier
- func (ctx ServiceCtx) GetDistService() dserv.IDistService
- func (ctx ServiceCtx) GetDistSync() dsync.IDistSync
- func (ctx ServiceCtx) GetMemKVs() *sync.Map
- func (ctx ServiceCtx) GetRPC() rpc.IRPC
- func (ctx ServiceCtx) GetRegistry() discovery.IRegistry
- func (ctx ServiceCtx) GetStartupConf() *viper.Viper
Constants ¶
This section is empty.
Variables ¶
var (
ErrComponentNotWorking = errors.New("async/await: component not working")
)
Functions ¶
Types ¶
type AwaitDirector ¶
type AwaitDirector struct {
// contains filtered or unexported fields
}
AwaitDirector 异步等待分发器
func (AwaitDirector) All ¶
func (ad AwaitDirector) All(fun generic.ActionVar1[[]runtime.Ret, any], va ...any)
All 异步等待所有结果返回
func (AwaitDirector) Any ¶
func (ad AwaitDirector) Any(fun generic.ActionVar1[runtime.Ret, any], va ...any)
Any 异步等待任意一个结果返回
func (AwaitDirector) AnyOK ¶
func (ad AwaitDirector) AnyOK(fun generic.ActionVar1[runtime.Ret, any], va ...any)
AnyOK 异步等待任意一个结果成功返回
type ComponentBehavior ¶
type ComponentBehavior struct {
ec.ComponentBehavior
}
ComponentBehavior 组件行为,在开发新组件时,匿名嵌入至组件结构体中
func (*ComponentBehavior) Async ¶
func (c *ComponentBehavior) Async(fun generic.FuncVar0[any, runtime.Ret], va ...any) runtime.AsyncRet
Async 异步执行代码,有返回值
func (*ComponentBehavior) AsyncVoid ¶
func (c *ComponentBehavior) AsyncVoid(fun generic.ActionVar0[any], va ...any) runtime.AsyncRet
AsyncVoid 异步执行代码,无返回值
func (*ComponentBehavior) Await ¶
func (c *ComponentBehavior) Await(asyncRet ...runtime.AsyncRet) AwaitDirector
Await 异步等待结果返回
func (*ComponentBehavior) BalanceOneWayRPC ¶
func (c *ComponentBehavior) BalanceOneWayRPC(service, comp, method string, args ...any) error
BalanceOneWayRPC 使用负载均衡模式,向分布式实体目标服务发送单向RPC
func (*ComponentBehavior) BalanceRPC ¶
func (c *ComponentBehavior) BalanceRPC(service, comp, method string, args ...any) runtime.AsyncRet
BalanceRPC 使用负载均衡模式,向分布式实体目标服务发送RPC
func (*ComponentBehavior) BroadcastOneWayRPC ¶
func (c *ComponentBehavior) BroadcastOneWayRPC(service, comp, method string, args ...any) error
BroadcastOneWayRPC 使用广播模式,向分布式实体目标服务发送单向RPC
func (*ComponentBehavior) CliRPC ¶ added in v0.1.36
func (c *ComponentBehavior) CliRPC(method string, args ...any) runtime.AsyncRet
CliRPC 向客户端发送RPC
func (*ComponentBehavior) CliRPCToEntity ¶ added in v0.1.36
func (c *ComponentBehavior) CliRPCToEntity(entityId uid.Id, method string, args ...any) runtime.AsyncRet
CliRPCToEntity 向客户端实体发送RPC
func (*ComponentBehavior) GetRuntimeCtx ¶
func (c *ComponentBehavior) GetRuntimeCtx() RuntimeCtx
GetRuntimeCtx 获取运行时上下文
func (*ComponentBehavior) GetServiceCtx ¶
func (c *ComponentBehavior) GetServiceCtx() ServiceCtx
GetServiceCtx 获取服务上下文
func (*ComponentBehavior) GlobalBalanceOneWayRPC ¶
func (c *ComponentBehavior) GlobalBalanceOneWayRPC(comp, method string, args ...any) error
GlobalBalanceOneWayRPC 使用全局负载均衡模式,向分布式实体任意服务发送单向RPC
func (*ComponentBehavior) GlobalBalanceRPC ¶
func (c *ComponentBehavior) GlobalBalanceRPC(comp, method string, args ...any) runtime.AsyncRet
GlobalBalanceRPC 使用全局负载均衡模式,向分布式实体任意服务发送RPC
func (*ComponentBehavior) GlobalBroadcastOneWayRPC ¶
func (c *ComponentBehavior) GlobalBroadcastOneWayRPC(comp, method string, args ...any) error
GlobalBroadcastOneWayRPC 使用全局广播模式,向分布式实体所有服务发送单向RPC
func (*ComponentBehavior) GoVoid ¶
func (c *ComponentBehavior) GoVoid(fun generic.ActionVar0[any], va ...any) runtime.AsyncRet
GoVoid 使用新线程执行代码,无返回值(注意线程安全)
func (*ComponentBehavior) OneWayCliRPC ¶ added in v0.1.36
func (c *ComponentBehavior) OneWayCliRPC(method string, args ...any) error
OneWayCliRPC 向客户端发送单向RPC
func (*ComponentBehavior) OneWayCliRPCToEntity ¶ added in v0.1.36
OneWayCliRPCToEntity 向客户端实体发送单向RPC
func (*ComponentBehavior) OneWayRPC ¶
func (c *ComponentBehavior) OneWayRPC(service, comp, method string, args ...any) error
OneWayRPC 向分布式实体目标服务发送单向RPC
func (*ComponentBehavior) RPC ¶
func (c *ComponentBehavior) RPC(service, comp, method string, args ...any) runtime.AsyncRet
RPC 向分布式实体目标服务发送RPC
func (*ComponentBehavior) TimeAfter ¶
func (c *ComponentBehavior) TimeAfter(dur time.Duration) runtime.AsyncRet
TimeAfter 定时器,指定时长
type RuntimeCtx ¶
RuntimeCtx 运行时上下文
func (RuntimeCtx) CreateEntity ¶ added in v0.1.32
func (ctx RuntimeCtx) CreateEntity() core.EntityCreator
CreateEntity 创建实体
func (RuntimeCtx) GetDistEntities ¶
func (ctx RuntimeCtx) GetDistEntities() dent.IDistEntities
GetDistEntities 获取分布式实体支持插件
type ServiceCtx ¶
ServiceCtx 服务上下文
func (ServiceCtx) CreateEntityPT ¶ added in v0.1.32
func (ctx ServiceCtx) CreateEntityPT() core.EntityPTCreator
CreateEntityPT 创建实体原型
func (ServiceCtx) CreateRuntime ¶ added in v0.1.32
func (ctx ServiceCtx) CreateRuntime() framework.RuntimeCreator
CreateRuntime 创建运行时
func (ServiceCtx) GetDistEntityQuerier ¶
func (ctx ServiceCtx) GetDistEntityQuerier() dentq.IDistEntityQuerier
GetDistEntityQuerier 获取分布式实体查询插件
func (ServiceCtx) GetDistService ¶
func (ctx ServiceCtx) GetDistService() dserv.IDistService
GetDistService 获取分布式服务插件
func (ServiceCtx) GetDistSync ¶
func (ctx ServiceCtx) GetDistSync() dsync.IDistSync
GetDistSync 获取分布式同步插件
func (ServiceCtx) GetMemKVs ¶ added in v0.1.27
func (ctx ServiceCtx) GetMemKVs() *sync.Map
GetMemKVs 获取服务内存KV数据库
func (ServiceCtx) GetRegistry ¶
func (ctx ServiceCtx) GetRegistry() discovery.IRegistry
GetRegistry 获取服务发现插件
func (ServiceCtx) GetStartupConf ¶ added in v0.1.27
func (ctx ServiceCtx) GetStartupConf() *viper.Viper
GetStartupConf 获取启动参数配置