framework

package module
v0.2.47 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2024 License: LGPL-2.1 Imports: 49 Imported by: 7

README

Framework

English | 简体中文

Introduction

Golaxy Distributed Service Development Framework aims to provide a comprehensive server-side solution for real-time communication applications. Based on the core of the EC system and Actor thread model, the framework implements all dependency functions for distributed services. It is designed to be simple and easy to use, making it particularly suitable for developing games and remote control systems.

Features

The framework supports the development of stateful (Stateful) or stateless (Stateless) distributed services with the following features:

  • MQ and Broker: Based on NATS, supports message queue and event-driven architecture.
  • Service Discovery: Based on ETCD, also supports Redis (for demo purposes due to lack of data version control).
  • Distributed Synchronization: Supports distributed locking with ETCD or Redis, default is ETCD.
  • Distributed Service: Defines distributed service node address format, provides asynchronous model futures (Future), supports inter-service communication and horizontal scaling.
  • Distributed Entities: Provides registration and query functions for distributed entities, supports communication between them.
  • GTP Protocol: For long connections and real-time communication, works on reliable protocols (TCP/WebSocket), supports bi-directional signature verification, link encryption, link authentication, reconnect and retransmission, custom messages.
  • GAP Protocol: For application layer communication messages, works on GTP Protocol or MQ, supports message deduplication, custom messages, custom variable types.
  • GTP Gate and Client: Gateway and client based on GTP Protocol, supports TCP/WebSocket long connections.
  • Router: Supports communication routing, session to entity mapping, client-service communication, communication grouping, and multicast messages.
  • RPC: Supports RPC calls between services, entities, clients, and groups based on GAP Protocol, supports variable types, simple and easy to use. Supports one-way notification RPC and response RPC.
  • Logger: Based on Zap.
  • Config: Based on Viper, supports local and remote configurations.
  • Database: Supports connection to relational databases (based on GORM), Redis, MongoDB.

Directory

Directory Description
/ Common types and functions for application development.
/net/gap GAP protocol implementation.
/net/gtp GTP protocol implementation.
/net/netpath Service node address structure.
/plugins/broker Message queue middleware.
/plugins/conf Configuration system.
/plugins/db Database support.
/plugins/dentq Distributed entity query support.
/plugins/dentr Distributed entity registration support.
/plugins/discovery Service discovery.
/plugins/dsvc Distributed service support.
/plugins/dsync Distributed locking.
/plugins/gate GTP gateway implementation.
/plugins/log Logging system.
/plugins/router Client routing system.
/plugins/rpc RPC system.
/plugins/rpcstack RPC stack support.

Examples

See: Examples

Installation

go get -u git.golaxy.org/framework

Documentation

Overview

Package framework Golaxy分布式服务开发框架。

Index

Constants

This section is empty.

Variables

View Source
var CreateEntityPT = core.CreateEntityPT

CreateEntityPT 创建实体原型

View Source
var (
	ErrComponentNotAlive = errors.New("async/await: component not alive")
)
View Source
var (
	ErrEntityNotAlive = errors.New("async/await: entity not alive")
)

Functions

func ReadChan added in v0.1.56

func ReadChan[T any](iec iEC, ch <-chan T) async.AsyncRet

ReadChan 读取channel

Types

type App

type App struct {
	// contains filtered or unexported fields
}

App 应用

func NewApp

func NewApp() *App

NewApp 创建应用

func (*App) GetStartupConf

func (app *App) GetStartupConf() *viper.Viper

GetStartupConf 获取启动参数配置

func (*App) InitCB

func (app *App) InitCB(cb generic.DelegateAction1[*cobra.Command]) *App

InitCB 初始化回调

func (*App) Run

func (app *App) Run()

Run 运行

func (*App) Setup

func (app *App) Setup(name string, generic any) *App

Setup 安装服务泛化类型

func (*App) StartingCB

func (app *App) StartingCB(cb generic.DelegateAction1[*App]) *App

StartingCB 启动回调

func (*App) TerminateCB added in v0.1.33

func (app *App) TerminateCB(cb generic.DelegateAction1[*App]) *App

TerminateCB 终止回调

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.ActionVar1[[]async.Ret, any], args ...any)

All 异步等待所有结果返回

func (AwaitDirector) Any added in v0.1.56

func (ad AwaitDirector) Any(fun generic.ActionVar1[async.Ret, any], args ...any)

Any 异步等待任意一个结果返回

func (AwaitDirector) AnyOK added in v0.1.56

func (ad AwaitDirector) AnyOK(fun generic.ActionVar1[async.Ret, any], args ...any)

AnyOK 异步等待任意一个结果成功返回

func (AwaitDirector) Pipe added in v0.1.56

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

Pipe 异步等待管道返回

type ComponentBehavior added in v0.1.56

type ComponentBehavior struct {
	ec.ComponentBehavior
}

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

func (*ComponentBehavior) Async added in v0.1.56

func (c *ComponentBehavior) Async(fun generic.FuncVar0[any, async.Ret], args ...any) async.AsyncRet

Async 异步执行代码,有返回值

func (*ComponentBehavior) AsyncVoid added in v0.1.56

func (c *ComponentBehavior) AsyncVoid(fun generic.ActionVar0[any], args ...any) async.AsyncRet

AsyncVoid 异步执行代码,无返回值

func (*ComponentBehavior) Await added in v0.1.56

func (c *ComponentBehavior) Await(asyncRet ...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) 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) GetPluginBundle added in v0.1.80

func (c *ComponentBehavior) GetPluginBundle() plugin.PluginBundle

GetPluginBundle 获取插件包

func (*ComponentBehavior) GetRuntime added in v0.1.56

func (c *ComponentBehavior) GetRuntime() IRuntimeInstance

GetRuntime 获取运行时

func (*ComponentBehavior) GetService added in v0.1.56

func (c *ComponentBehavior) GetService() IServiceInstance

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) Go added in v0.1.56

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

func (*ComponentBehavior) GoVoid added in v0.1.56

func (c *ComponentBehavior) GoVoid(fun generic.ActionVar0[any], args ...any) async.AsyncRet

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

func (*ComponentBehavior) IsAlive added in v0.1.76

func (c *ComponentBehavior) IsAlive() bool

IsAlive 是否活跃

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) TimeAfter added in v0.1.56

func (c *ComponentBehavior) TimeAfter(dur time.Duration) async.AsyncRet

TimeAfter 定时器,指定时长

func (*ComponentBehavior) TimeAt added in v0.1.56

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

TimeAt 定时器,指定时间点

func (*ComponentBehavior) TimeTick added in v0.1.56

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

TimeTick 心跳器

type ConcurrentEntityCreator added in v0.1.77

type ConcurrentEntityCreator struct {
	// contains filtered or unexported fields
}

ConcurrentEntityCreator 实体构建器

func CreateConcurrentEntity added in v0.1.77

func CreateConcurrentEntity(svcCtx service.Context, prototype string) ConcurrentEntityCreator

CreateConcurrentEntity 创建实体

func (ConcurrentEntityCreator) AwakeOnFirstAccess added in v0.1.77

func (c ConcurrentEntityCreator) AwakeOnFirstAccess(b bool) ConcurrentEntityCreator

AwakeOnFirstAccess 设置开启组件被首次访问时,检测并调用Awake()

func (ConcurrentEntityCreator) Instance added in v0.2.38

Instance 实例,用于扩展实体能力

func (ConcurrentEntityCreator) InstanceFace added in v0.2.38

InstanceFace 实例,用于扩展实体能力

func (ConcurrentEntityCreator) Meta added in v0.1.77

Meta 设置Meta信息

func (ConcurrentEntityCreator) ParentId added in v0.1.77

ParentId 设置父实体Id

func (ConcurrentEntityCreator) PersistId added in v0.1.77

PersistId 设置实体持久化Id

func (ConcurrentEntityCreator) Runtime added in v0.1.77

Runtime 设置运行时(优先使用)

func (ConcurrentEntityCreator) RuntimeCreator added in v0.1.77

RuntimeCreator 设置运行时构建器

func (ConcurrentEntityCreator) Scope added in v0.1.77

Scope 设置实体的可访问作用域

func (ConcurrentEntityCreator) Spawn added in v0.1.77

Spawn 创建实体

func (ConcurrentEntityCreator) SpawnAsync added in v0.1.77

SpawnAsync 创建实体

type EntityBehavior added in v0.1.76

type EntityBehavior struct {
	ec.EntityBehavior
}

EntityBehavior 实体行为,在需要扩展实体能力时,匿名嵌入至实体结构体中

func (*EntityBehavior) Async added in v0.1.76

func (e *EntityBehavior) Async(fun generic.FuncVar0[any, async.Ret], args ...any) async.AsyncRet

Async 异步执行代码,有返回值

func (*EntityBehavior) AsyncVoid added in v0.1.76

func (e *EntityBehavior) AsyncVoid(fun generic.ActionVar0[any], args ...any) async.AsyncRet

AsyncVoid 异步执行代码,无返回值

func (*EntityBehavior) Await added in v0.1.76

func (e *EntityBehavior) Await(asyncRet ...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) 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) GetPluginBundle added in v0.1.80

func (e *EntityBehavior) GetPluginBundle() plugin.PluginBundle

GetPluginBundle 获取插件包

func (*EntityBehavior) GetRuntime added in v0.1.76

func (e *EntityBehavior) GetRuntime() IRuntimeInstance

GetRuntime 获取运行时

func (*EntityBehavior) GetService added in v0.1.76

func (e *EntityBehavior) GetService() IServiceInstance

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) Go added in v0.1.76

func (e *EntityBehavior) Go(fun generic.FuncVar0[any, async.Ret], args ...any) async.AsyncRet

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

func (*EntityBehavior) GoVoid added in v0.1.76

func (e *EntityBehavior) GoVoid(fun generic.ActionVar0[any], args ...any) async.AsyncRet

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

func (*EntityBehavior) IsAlive added in v0.1.76

func (e *EntityBehavior) IsAlive() bool

IsAlive 是否活跃

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) TimeAfter added in v0.1.76

func (e *EntityBehavior) TimeAfter(dur time.Duration) async.AsyncRet

TimeAfter 定时器,指定时长

func (*EntityBehavior) TimeAt added in v0.1.76

func (e *EntityBehavior) TimeAt(at time.Time) async.AsyncRet

TimeAt 定时器,指定时间点

func (*EntityBehavior) TimeTick added in v0.1.76

func (e *EntityBehavior) TimeTick(dur time.Duration) async.AsyncRet

TimeTick 心跳器

type EntityPTCreator added in v0.1.77

type EntityPTCreator = core.EntityPTCreator

EntityPTCreator 实体原型构建器

type IRuntimeInstance added in v0.1.37

type IRuntimeInstance interface {
	runtime.Context
	// GetDistEntityRegistry 获取分布式实体注册支持
	GetDistEntityRegistry() dentr.IDistEntityRegistry
	// GetRPCStack 获取RPC调用堆栈支持
	GetRPCStack() rpcstack.IRPCStack
	// GetService 获取服务实例
	GetService() IServiceInstance
	// CreateEntity 创建实体
	CreateEntity(prototype string) core.EntityCreator
}

IRuntimeInstance 运行时实例接口

func GetRuntimeInstance added in v0.1.88

func GetRuntimeInstance(provider runtime.CurrentContextProvider) IRuntimeInstance

GetRuntimeInstance 获取运行时实例

type IRuntimeInstantiation added in v0.1.45

type IRuntimeInstantiation interface {
	Instantiation() IRuntimeInstance
}

IRuntimeInstantiation 运行时实例化接口

type IServiceInstance added in v0.1.37

type IServiceInstance interface {
	service.Context
	// GetConf 获取配置插件
	GetConf() conf.IConfig
	// 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
	// GetStartupConf 获取启动参数配置
	GetStartupConf() *viper.Viper
	// GetMemKV 获取服务内存KV数据库
	GetMemKV() *sync.Map
	// CreateRuntime 创建运行时
	CreateRuntime() RuntimeCreator
	// CreateEntityPT 创建实体原型
	CreateEntityPT(prototype string) core.EntityPTCreator
	// CreateConcurrentEntity 创建实体
	CreateConcurrentEntity(prototype string) ConcurrentEntityCreator
}

IServiceInstance 服务实例接口

func GetServiceInstance added in v0.1.88

func GetServiceInstance(provider runtime.ConcurrentContextProvider) IServiceInstance

GetServiceInstance 获取服务实例

type IServiceInstantiation added in v0.1.45

type IServiceInstantiation interface {
	Instantiation() IServiceInstance
}

IServiceInstantiation 服务实例化接口

type InstallRuntimeDistEntityRegistry added in v0.1.87

type InstallRuntimeDistEntityRegistry interface {
	InstallDistEntityRegistry(inst IRuntimeInstance)
}

type InstallRuntimeLogger

type InstallRuntimeLogger interface {
	InstallLogger(inst IRuntimeInstance)
}

type InstallRuntimeRPCStack added in v0.1.69

type InstallRuntimeRPCStack interface {
	InstallRPCStack(inst IRuntimeInstance)
}

type InstallServiceBroker

type InstallServiceBroker interface {
	InstallBroker(inst IServiceInstance)
}

type InstallServiceConfig

type InstallServiceConfig interface {
	InstallConfig(inst IServiceInstance)
}

type InstallServiceDistEntityQuerier

type InstallServiceDistEntityQuerier interface {
	InstallDistEntityQuerier(inst IServiceInstance)
}

type InstallServiceDistService

type InstallServiceDistService interface {
	InstallDistService(inst IServiceInstance)
}

type InstallServiceDistSync

type InstallServiceDistSync interface {
	InstallDistSync(inst IServiceInstance)
}

type InstallServiceLogger

type InstallServiceLogger interface {
	InstallLogger(inst IServiceInstance)
}

type InstallServiceRPC

type InstallServiceRPC interface {
	InstallRPC(inst IServiceInstance)
}

type InstallServiceRegistry

type InstallServiceRegistry interface {
	InstallRegistry(inst IServiceInstance)
}

type LifecycleRuntimeBirth

type LifecycleRuntimeBirth interface {
	Birth(inst IRuntimeInstance)
}

type LifecycleRuntimeBuilt added in v0.1.45

type LifecycleRuntimeBuilt interface {
	Built(inst IRuntimeInstance)
}

type LifecycleRuntimeFrameLoopBegin

type LifecycleRuntimeFrameLoopBegin interface {
	FrameLoopBegin(inst IRuntimeInstance)
}

type LifecycleRuntimeFrameLoopEnd

type LifecycleRuntimeFrameLoopEnd interface {
	FrameLoopEnd(inst IRuntimeInstance)
}

type LifecycleRuntimeFrameUpdateBegin

type LifecycleRuntimeFrameUpdateBegin interface {
	FrameUpdateBegin(inst IRuntimeInstance)
}

type LifecycleRuntimeFrameUpdateEnd

type LifecycleRuntimeFrameUpdateEnd interface {
	FrameUpdateEnd(inst IRuntimeInstance)
}

type LifecycleRuntimeRunCallBegin

type LifecycleRuntimeRunCallBegin interface {
	RunCallBegin(inst IRuntimeInstance)
}

type LifecycleRuntimeRunCallEnd

type LifecycleRuntimeRunCallEnd interface {
	RunCallEnd(inst IRuntimeInstance)
}

type LifecycleRuntimeRunGCBegin

type LifecycleRuntimeRunGCBegin interface {
	RunGCBegin(inst IRuntimeInstance)
}

type LifecycleRuntimeRunGCEnd

type LifecycleRuntimeRunGCEnd interface {
	RunGCEnd(inst IRuntimeInstance)
}

type LifecycleRuntimeStarted

type LifecycleRuntimeStarted interface {
	Started(inst IRuntimeInstance)
}

type LifecycleRuntimeStarting

type LifecycleRuntimeStarting interface {
	Starting(inst IRuntimeInstance)
}

type LifecycleRuntimeTerminated

type LifecycleRuntimeTerminated interface {
	Terminated(inst IRuntimeInstance)
}

type LifecycleRuntimeTerminating

type LifecycleRuntimeTerminating interface {
	Terminating(inst IRuntimeInstance)
}

type LifecycleServiceBirth

type LifecycleServiceBirth interface {
	Birth(inst IServiceInstance)
}

type LifecycleServiceBuilt added in v0.1.45

type LifecycleServiceBuilt interface {
	Built(inst IServiceInstance)
}

type LifecycleServiceStarted

type LifecycleServiceStarted interface {
	Started(inst IServiceInstance)
}

type LifecycleServiceStarting

type LifecycleServiceStarting interface {
	Starting(inst IServiceInstance)
}

type LifecycleServiceTerminated

type LifecycleServiceTerminated interface {
	Terminated(inst IServiceInstance)
}

type LifecycleServiceTerminating

type LifecycleServiceTerminating interface {
	Terminating(inst IServiceInstance)
}

type RuntimeCreator

type RuntimeCreator struct {
	// contains filtered or unexported fields
}

RuntimeCreator 运行时构建器

func CreateRuntime

func CreateRuntime(svcCtx service.Context) RuntimeCreator

CreateRuntime 创建运行时

func (RuntimeCreator) FPS added in v0.1.27

FPS 帧率

func (RuntimeCreator) Name

func (c RuntimeCreator) Name(name string) RuntimeCreator

Name 名称

func (RuntimeCreator) PanicHandling added in v0.1.27

func (c RuntimeCreator) PanicHandling(autoRecover bool, reportError chan error) RuntimeCreator

PanicHandling panic时的处理方式

func (RuntimeCreator) PersistId added in v0.1.93

func (c RuntimeCreator) PersistId(id uid.Id) RuntimeCreator

PersistId 持久化Id

func (RuntimeCreator) ProcessQueueCapacity

func (c RuntimeCreator) ProcessQueueCapacity(cap int) RuntimeCreator

ProcessQueueCapacity 任务处理流水线大小

func (RuntimeCreator) Setup

func (c RuntimeCreator) Setup(generic any) RuntimeCreator

Setup 安装运行时泛化类型

func (RuntimeCreator) Spawn

func (c RuntimeCreator) Spawn() IRuntimeInstance

Spawn 创建运行时

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

GetService 获取服务

func (*RuntimeGeneric) OnEntityMgrAddEntity added in v0.2.46

func (r *RuntimeGeneric) OnEntityMgrAddEntity(entityMgr runtime.EntityMgr, entity ec.Entity)

OnEntityMgrAddEntity 事件处理器:实体管理器添加实体

func (*RuntimeGeneric) OnEntityMgrEntityAddComponents added in v0.2.46

func (r *RuntimeGeneric) OnEntityMgrEntityAddComponents(entityMgr runtime.EntityMgr, entity ec.Entity, components []ec.Component)

OnEntityMgrEntityAddComponents 事件处理器:实体管理器中的实体添加组件

type RuntimeGenericT added in v0.1.62

type RuntimeGenericT[T any] struct {
	RuntimeGeneric
}

RuntimeGenericT 运行时泛化类型实例化

func NewRuntimeGenericT added in v0.2.31

func NewRuntimeGenericT[T any]() *RuntimeGenericT[T]

NewRuntimeGenericT 创建运行时泛化类型

func (*RuntimeGenericT[T]) Instantiation added in v0.1.62

func (r *RuntimeGenericT[T]) Instantiation() IRuntimeInstance

Instantiation 实例化

type RuntimeInstance added in v0.1.45

type RuntimeInstance struct {
	runtime.ContextBehavior
}

RuntimeInstance 运行时实例

func (*RuntimeInstance) CreateEntity added in v0.1.45

func (inst *RuntimeInstance) CreateEntity(prototype string) core.EntityCreator

CreateEntity 创建实体

func (*RuntimeInstance) GetDistEntityRegistry added in v0.1.87

func (inst *RuntimeInstance) GetDistEntityRegistry() dentr.IDistEntityRegistry

GetDistEntityRegistry 获取分布式实体注册支持

func (*RuntimeInstance) GetRPCStack added in v0.1.87

func (inst *RuntimeInstance) GetRPCStack() rpcstack.IRPCStack

GetRPCStack 获取RPC调用堆栈支持

func (*RuntimeInstance) GetService added in v0.1.87

func (inst *RuntimeInstance) GetService() IServiceInstance

GetService 获取服务

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) GetStartupConf added in v0.1.37

func (s *ServiceGeneric) GetStartupConf() *viper.Viper

GetStartupConf 获取启动参数配置

type ServiceGenericT added in v0.1.62

type ServiceGenericT[T any] struct {
	ServiceGeneric
}

ServiceGenericT 服务泛化类型实例化

func NewServiceGenericT added in v0.2.31

func NewServiceGenericT[T any]() *ServiceGenericT[T]

NewServiceGenericT 创建服务泛化类型

func (*ServiceGenericT[T]) Instantiation added in v0.1.62

func (s *ServiceGenericT[T]) Instantiation() IServiceInstance

Instantiation 实例化

type ServiceInstance added in v0.1.45

type ServiceInstance struct {
	service.ContextBehavior
	RuntimeGenericT[RuntimeInstance]
}

ServiceInstance 服务实例

func (*ServiceInstance) CreateConcurrentEntity added in v0.1.77

func (inst *ServiceInstance) CreateConcurrentEntity(prototype string) ConcurrentEntityCreator

CreateConcurrentEntity 创建实体

func (*ServiceInstance) CreateEntityPT added in v0.1.45

func (inst *ServiceInstance) CreateEntityPT(prototype string) core.EntityPTCreator

CreateEntityPT 创建实体原型

func (*ServiceInstance) CreateRuntime added in v0.1.45

func (inst *ServiceInstance) CreateRuntime() RuntimeCreator

CreateRuntime 创建运行时

func (*ServiceInstance) GetBroker added in v0.1.45

func (inst *ServiceInstance) GetBroker() broker.IBroker

GetBroker 获取消息队列中间件插件

func (*ServiceInstance) GetConf added in v0.1.45

func (inst *ServiceInstance) GetConf() conf.IConfig

GetConf 获取配置插件

func (*ServiceInstance) GetDistEntityQuerier added in v0.1.45

func (inst *ServiceInstance) GetDistEntityQuerier() dentq.IDistEntityQuerier

GetDistEntityQuerier 获取分布式实体查询插件

func (*ServiceInstance) GetDistService added in v0.1.45

func (inst *ServiceInstance) GetDistService() dsvc.IDistService

GetDistService 获取分布式服务插件

func (*ServiceInstance) GetDistSync added in v0.1.45

func (inst *ServiceInstance) GetDistSync() dsync.IDistSync

GetDistSync 获取分布式同步插件

func (*ServiceInstance) GetMemKV added in v0.1.71

func (inst *ServiceInstance) GetMemKV() *sync.Map

GetMemKV 获取服务内存KV数据库

func (*ServiceInstance) GetRPC added in v0.1.45

func (inst *ServiceInstance) GetRPC() rpc.IRPC

GetRPC 获取RPC支持插件

func (*ServiceInstance) GetRegistry added in v0.1.45

func (inst *ServiceInstance) GetRegistry() discovery.IRegistry

GetRegistry 获取服务发现插件

func (*ServiceInstance) GetStartupConf added in v0.1.45

func (inst *ServiceInstance) GetStartupConf() *viper.Viper

GetStartupConf 获取启动参数配置

func (*ServiceInstance) GetStartupNo added in v0.1.71

func (inst *ServiceInstance) GetStartupNo() int

GetStartupNo 获取启动序号

Directories

Path Synopsis
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)之上,支持链路加密、链路鉴权、断线续连等特性。
plugins
db
log
rpc
utils

Jump to

Keyboard shortcuts

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