oc

package
v0.1.26 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: LGPL-2.1 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDistEntityNotFound     = errors.New("rpc: distributed entity not found")
	ErrDistEntityNodeNotFound = errors.New("rpc: distributed entity node not found")
)
View Source
var (
	ErrComponentIsDead = errors.New("async/await: component is dead")
)

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(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) GetRuntimeCtx

func (c *ComponentBehavior) GetRuntimeCtx() RuntimeCtx

func (*ComponentBehavior) GetServiceCtx

func (c *ComponentBehavior) GetServiceCtx() ServiceCtx

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

type EntityProxied struct {
	Context service.Context
	Id      uid.Id
}

EntityProxied 实体代理,用于向实体发送RPC

func ProxyEntity

func ProxyEntity(servCtx service.Context, id uid.Id) EntityProxied

ProxyEntity 代理实体

func (EntityProxied) BalanceOneWayRPC

func (ep EntityProxied) BalanceOneWayRPC(service, comp, method string, args ...any) error

BalanceOneWayRPC 使用负载均衡模式,向分布式实体目标服务发送单向RPC

func (EntityProxied) BalanceRPC

func (ep EntityProxied) BalanceRPC(service, comp, method string, args ...any) runtime.AsyncRet

BalanceRPC 使用负载均衡模式,向分布式实体目标服务发送RPC

func (EntityProxied) BroadcastOneWayRPC

func (ep EntityProxied) BroadcastOneWayRPC(service, comp, method string, args ...any) error

BroadcastOneWayRPC 使用广播模式,向分布式实体目标服务发送单向RPC

func (EntityProxied) GlobalBalanceOneWayRPC

func (ep EntityProxied) GlobalBalanceOneWayRPC(comp, method string, args ...any) error

GlobalBalanceOneWayRPC 使用全局负载均衡模式,向分布式实体任意服务发送单向RPC

func (EntityProxied) GlobalBalanceRPC

func (ep EntityProxied) GlobalBalanceRPC(comp, method string, args ...any) runtime.AsyncRet

GlobalBalanceRPC 使用全局负载均衡模式,向分布式实体任意服务发送RPC

func (EntityProxied) GlobalBroadcastOneWayRPC

func (ep EntityProxied) GlobalBroadcastOneWayRPC(comp, method string, args ...any) error

GlobalBroadcastOneWayRPC 使用全局广播模式,向分布式实体所有服务发送单向RPC

func (EntityProxied) OneWayRPC

func (ep EntityProxied) OneWayRPC(service, comp, method string, args ...any) error

OneWayRPC 向分布式实体目标服务发送单向RPC

func (EntityProxied) RPC

func (ep EntityProxied) RPC(service, comp, method string, args ...any) runtime.AsyncRet

RPC 向分布式实体目标服务发送RPC

type RuntimeCtx

type RuntimeCtx struct {
	runtime.Context
}

func (RuntimeCtx) GetDistEntities

func (ctx RuntimeCtx) GetDistEntities() dent.IDistEntities

type ServiceCtx

type ServiceCtx struct {
	service.Context
}

func (ServiceCtx) GetBroker

func (ctx ServiceCtx) GetBroker() broker.IBroker

func (ServiceCtx) GetConf

func (ctx ServiceCtx) GetConf() conf.IVisitConf

func (ServiceCtx) GetDistEntityQuerier

func (ctx ServiceCtx) GetDistEntityQuerier() dentq.IDistEntityQuerier

func (ServiceCtx) GetDistService

func (ctx ServiceCtx) GetDistService() dserv.IDistService

func (ServiceCtx) GetDistSync

func (ctx ServiceCtx) GetDistSync() dsync.IDistSync

func (ServiceCtx) GetRPC

func (ctx ServiceCtx) GetRPC() rpc.IRPC

func (ServiceCtx) GetRegistry

func (ctx ServiceCtx) GetRegistry() discovery.IRegistry

Jump to

Keyboard shortcuts

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