framework

package module
v0.1.33 Latest Latest
Warning

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

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

README

framework

Golaxy分布式服务开发框架,基于Actor线程模型(Actor Model)与分布式实体(Distributed Entities)架构,可以快速开发服务器应用。

本框架特点如下:

...

本包提供以下插件:

  • 消息队列与事件驱动架构(MQ and Broker),基于NATS。
  • 服务发现(Service Discovery),基于Etcd或Redis。
  • 分布式锁(Distributed Sync),基于Etcd或Redis。
  • GTP协议(Golaxy Transfer Protocol),适用于长连接、实时通信的工作场景,需要工作在可靠网络协议(TCP/KCP)之上,支持链路加密、链路鉴权、断线续连等特性。
  • GTP协议网关和客户端(GTP Gate and Client)。
  • GAP协议(Golaxy Application Protocol),适用于开发应用层通信消息,需要工作在GTP协议或MQ之上,支持消息判重,解决了幂等性问题。
  • 分布式服务支持(Distributed Service)。
  • 分布式实体支持(Distributed Entities)。
  • RPC支持(Remote Procedure Call)。
  • 日志(Logger)。

Install

go get -u git.golaxy.org/framework

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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[*App]) *App

InitCB 初始化回调

func (*App) Run

func (app *App) Run()

Run 运行

func (*App) Setup

func (app *App) Setup(name string, serv 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 InstallRuntimeDistEntities

type InstallRuntimeDistEntities interface {
	InstallDistEntities(ctx runtime.Context)
}

type InstallRuntimeLogger

type InstallRuntimeLogger interface {
	InstallLogger(ctx runtime.Context)
}

type InstallServiceBroker

type InstallServiceBroker interface {
	InstallBroker(ctx service.Context)
}

type InstallServiceConfig

type InstallServiceConfig interface {
	InstallConfig(ctx service.Context)
}

type InstallServiceDistEntityQuerier

type InstallServiceDistEntityQuerier interface {
	InstallDistEntityQuerier(ctx service.Context)
}

type InstallServiceDistService

type InstallServiceDistService interface {
	InstallDistService(ctx service.Context)
}

type InstallServiceDistSync

type InstallServiceDistSync interface {
	InstallDistSync(ctx service.Context)
}

type InstallServiceLogger

type InstallServiceLogger interface {
	InstallLogger(ctx service.Context)
}

type InstallServiceRPC

type InstallServiceRPC interface {
	InstallRPC(ctx service.Context)
}

type InstallServiceRegistry

type InstallServiceRegistry interface {
	InstallRegistry(ctx service.Context)
}

type LifecycleRuntimeBirth

type LifecycleRuntimeBirth interface {
	Birth(ctx runtime.Context)
}

type LifecycleRuntimeContextBirth added in v0.1.32

type LifecycleRuntimeContextBirth interface {
	Birth()
}

type LifecycleRuntimeContextFrameLoopBegin added in v0.1.32

type LifecycleRuntimeContextFrameLoopBegin interface {
	FrameLoopBegin()
}

type LifecycleRuntimeContextFrameLoopEnd added in v0.1.32

type LifecycleRuntimeContextFrameLoopEnd interface {
	FrameLoopEnd()
}

type LifecycleRuntimeContextFrameUpdateBegin added in v0.1.32

type LifecycleRuntimeContextFrameUpdateBegin interface {
	FrameUpdateBegin()
}

type LifecycleRuntimeContextFrameUpdateEnd added in v0.1.32

type LifecycleRuntimeContextFrameUpdateEnd interface {
	FrameUpdateEnd()
}

type LifecycleRuntimeContextInit added in v0.1.32

type LifecycleRuntimeContextInit interface {
	Init()
}

type LifecycleRuntimeContextRunCallBegin added in v0.1.32

type LifecycleRuntimeContextRunCallBegin interface {
	RunCallBegin()
}

type LifecycleRuntimeContextRunCallEnd added in v0.1.32

type LifecycleRuntimeContextRunCallEnd interface {
	RunCallEnd()
}

type LifecycleRuntimeContextRunGCBegin added in v0.1.32

type LifecycleRuntimeContextRunGCBegin interface {
	RunGCBegin()
}

type LifecycleRuntimeContextRunGCEnd added in v0.1.32

type LifecycleRuntimeContextRunGCEnd interface {
	RunGCEnd()
}

type LifecycleRuntimeContextStarted added in v0.1.32

type LifecycleRuntimeContextStarted interface {
	Started()
}

type LifecycleRuntimeContextStarting added in v0.1.32

type LifecycleRuntimeContextStarting interface {
	Starting()
}

type LifecycleRuntimeContextTerminated added in v0.1.32

type LifecycleRuntimeContextTerminated interface {
	Terminated()
}

type LifecycleRuntimeContextTerminating added in v0.1.32

type LifecycleRuntimeContextTerminating interface {
	Terminating()
}

type LifecycleRuntimeFrameLoopBegin

type LifecycleRuntimeFrameLoopBegin interface {
	FrameLoopBegin(ctx runtime.Context)
}

type LifecycleRuntimeFrameLoopEnd

type LifecycleRuntimeFrameLoopEnd interface {
	FrameLoopEnd(ctx runtime.Context)
}

type LifecycleRuntimeFrameUpdateBegin

type LifecycleRuntimeFrameUpdateBegin interface {
	FrameUpdateBegin(ctx runtime.Context)
}

type LifecycleRuntimeFrameUpdateEnd

type LifecycleRuntimeFrameUpdateEnd interface {
	FrameUpdateEnd(ctx runtime.Context)
}

type LifecycleRuntimeInit

type LifecycleRuntimeInit interface {
	Init(ctx runtime.Context)
}

type LifecycleRuntimeRunCallBegin

type LifecycleRuntimeRunCallBegin interface {
	RunCallBegin(ctx runtime.Context)
}

type LifecycleRuntimeRunCallEnd

type LifecycleRuntimeRunCallEnd interface {
	RunCallEnd(ctx runtime.Context)
}

type LifecycleRuntimeRunGCBegin

type LifecycleRuntimeRunGCBegin interface {
	RunGCBegin(ctx runtime.Context)
}

type LifecycleRuntimeRunGCEnd

type LifecycleRuntimeRunGCEnd interface {
	RunGCEnd(ctx runtime.Context)
}

type LifecycleRuntimeStarted

type LifecycleRuntimeStarted interface {
	Started(ctx runtime.Context)
}

type LifecycleRuntimeStarting

type LifecycleRuntimeStarting interface {
	Starting(ctx runtime.Context)
}

type LifecycleRuntimeTerminated

type LifecycleRuntimeTerminated interface {
	Terminated(ctx runtime.Context)
}

type LifecycleRuntimeTerminating

type LifecycleRuntimeTerminating interface {
	Terminating(ctx runtime.Context)
}

type LifecycleServiceBirth

type LifecycleServiceBirth interface {
	Birth(ctx service.Context)
}

type LifecycleServiceContextBirth added in v0.1.32

type LifecycleServiceContextBirth interface {
	Birth()
}

type LifecycleServiceContextInit added in v0.1.32

type LifecycleServiceContextInit interface {
	Init()
}

type LifecycleServiceContextStarted added in v0.1.32

type LifecycleServiceContextStarted interface {
	Started()
}

type LifecycleServiceContextStarting added in v0.1.32

type LifecycleServiceContextStarting interface {
	Starting()
}

type LifecycleServiceContextTerminated added in v0.1.32

type LifecycleServiceContextTerminated interface {
	Terminated()
}

type LifecycleServiceContextTerminating added in v0.1.32

type LifecycleServiceContextTerminating interface {
	Terminating()
}

type LifecycleServiceInit

type LifecycleServiceInit interface {
	Init(ctx service.Context)
}

type LifecycleServiceStarted

type LifecycleServiceStarted interface {
	Started(ctx service.Context)
}

type LifecycleServiceStarting

type LifecycleServiceStarting interface {
	Starting(ctx service.Context)
}

type LifecycleServiceTerminated

type LifecycleServiceTerminated interface {
	Terminated(ctx service.Context)
}

type LifecycleServiceTerminating

type LifecycleServiceTerminating interface {
	Terminating(ctx service.Context)
}

type RuntimeBehavior

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

RuntimeBehavior 运行时行为,开发新运行环境时,匿名嵌入至新运行时结构体中

func (*RuntimeBehavior) GetMemKVs

func (rb *RuntimeBehavior) GetMemKVs() *sync.Map

GetMemKVs 获取服务内存KV数据库

func (*RuntimeBehavior) GetServiceCtx

func (rb *RuntimeBehavior) GetServiceCtx() service.Context

GetServiceCtx 获取服务上下文

func (*RuntimeBehavior) GetStartupConf

func (rb *RuntimeBehavior) GetStartupConf() *viper.Viper

GetStartupConf 获取启动参数配置

type RuntimeCreator

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

RuntimeCreator 运行时构建器

func CreateRuntime

func CreateRuntime(ctx service.Context) RuntimeCreator

CreateRuntime 创建运行时

func (RuntimeCreator) AutoRun

func (c RuntimeCreator) AutoRun(auto bool) RuntimeCreator

AutoRun 自动开始运行

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

func (c RuntimeCreator) ProcessQueueCapacity(cap int) RuntimeCreator

ProcessQueueCapacity 任务处理流水线大小

func (RuntimeCreator) Setup

func (c RuntimeCreator) Setup(rt any) RuntimeCreator

Setup 安装运行时

func (RuntimeCreator) Spawn

func (c RuntimeCreator) Spawn() core.Runtime

Spawn 创建运行时

type ServiceBehavior

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

ServiceBehavior 服务行为,在开发新服务时,匿名嵌入至服务结构体中

func (*ServiceBehavior) GetName

func (sb *ServiceBehavior) GetName() string

GetName 获取服务名称

func (*ServiceBehavior) GetStartupConf

func (sb *ServiceBehavior) GetStartupConf() *viper.Viper

GetStartupConf 获取启动参数配置

type SetupRuntimeContextComposite added in v0.1.32

type SetupRuntimeContextComposite interface {
	MakeContextComposite() runtime.Context
}

type SetupServiceContextComposite added in v0.1.32

type SetupServiceContextComposite interface {
	MakeContextComposite() service.Context
}

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/kcp/websocket)之上,支持链路加密、链路鉴权、断线续连等特性。
Package gtp Golaxy传输层协议(golaxy transfer protocol),适用于长连接、实时通信的工作场景,需要工作在可靠网络协议(tcp/kcp/websocket)之上,支持链路加密、链路鉴权、断线续连等特性。
plugins
dentq
+k8s:deepcopy-gen=package
+k8s:deepcopy-gen=package
discovery
+k8s:deepcopy-gen=package
+k8s:deepcopy-gen=package
log
rpc
util

Jump to

Keyboard shortcuts

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