oc

package
v0.1.43 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 31, 2024 License: LGPL-2.1 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrComponentNotWorking = errors.New("async/await: component not working")
)

Functions

func ReadChan

func ReadChan[T any](cb *ComponentBehavior, ch <-chan T) runtime.AsyncRet

ReadChan 读取channel

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 异步等待任意一个结果成功返回

func (AwaitDirector) Pipe

func (ad AwaitDirector) Pipe(ctx context.Context, fun generic.ActionVar1[runtime.Ret, any], va ...any)

Pipe 异步等待管道返回

type ComponentBehavior

type ComponentBehavior struct {
	ec.ComponentBehavior
}

ComponentBehavior 组件行为,在开发新组件时,匿名嵌入至组件结构体中

func (*ComponentBehavior) Async

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) Go

Go 使用新线程执行代码,有返回值(注意线程安全)

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

func (c *ComponentBehavior) OneWayCliRPCToEntity(entityId uid.Id, method string, args ...any) error

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 定时器,指定时长

func (*ComponentBehavior) TimeAt

func (c *ComponentBehavior) TimeAt(at time.Time) runtime.AsyncRet

TimeAt 定时器,指定时间点

func (*ComponentBehavior) TimeTick

func (c *ComponentBehavior) TimeTick(dur time.Duration) runtime.AsyncRet

TimeTick 心跳器

type RuntimeCtx

type RuntimeCtx struct {
	runtime.Context
}

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

type ServiceCtx struct {
	service.Context
}

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) GetBroker

func (ctx ServiceCtx) GetBroker() broker.IBroker

GetBroker 获取broker插件

func (ServiceCtx) GetConf

func (ctx ServiceCtx) GetConf() conf.IVisitConf

GetConf 获取配置插件

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) GetRPC

func (ctx ServiceCtx) GetRPC() rpc.IRPC

GetRPC 获取RPC支持插件

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 获取启动参数配置

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL