cherry

package module
v1.1.29 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: MIT Imports: 26 Imported by: 28

README

cherry

  • 这是一款分布式的go游戏服务器框架。
  • 基于golang + nats.io + pomelo protocol技术构建。
  • 它具备高性能、可伸缩、分布式、协程分组管理等特点。并且上手简单、易学。
  • 让开发者更多的关注游戏业务,高效完成功能实现。
  • 文档陆续补充中。。。

TODO

基础
  • 多环境profile配置
日志
  • 多文件配置输出
  • 过滤配置
  • LEVEL定义
  • 滚动日志
消息&路由
  • 包结构(pomelo)
  • 包解码编码
  • 消息路由
  • 消息序列化
  • 事件
  • 定时器
网络协议
  • tcp
  • websocket
  • http server
  • http client
  • kcp
数据配表
  • 本地加载配表
  • 第三方数据源加载配表(redis)
  • 热更新配表
  • 类型检测
  • 条件查询(go-linq)
集群
  • 文件配置方式加载节点
  • etcd方式加载&更新节点
  • nats.io
其他
  • mysql db队列
  • nat消息队列
  • gopher-lua脚本

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddNodeRouter added in v1.1.9

func AddNodeRouter(nodeType string, routingFunc crouter.RoutingFunc)

func Configure added in v1.1.5

func Configure(profilePath, profileName, nodeId string) cfacade.IApplication

func GetConnectors added in v1.1.29

func GetConnectors() []cfacade.IConnector

func GetRPC added in v1.1.29

func GetRPC() cfacade.RPCClient

func Kick added in v1.1.29

func Kick(nodeId string, uid cfacade.UID, val interface{}, close bool) error

func PostEvent added in v1.1.22

func PostEvent(event cfacade.IEvent)

func PublishRemote added in v1.1.29

func PublishRemote(nodeId string, route string, arg proto.Message)

func PublishRemoteByRoute added in v1.1.29

func PublishRemoteByRoute(route string, arg proto.Message)

func Push added in v1.1.29

func Push(frontendId string, route string, uid cfacade.UID, val interface{}) error

func RegisterCommand added in v1.1.5

func RegisterCommand(command ccommand.ICommand)

func RegisterComponent added in v1.1.5

func RegisterComponent(component ...cfacade.IComponent)

func RegisterConnector added in v1.1.5

func RegisterConnector(connector cfacade.IConnector)

func RegisterHandler added in v1.1.5

func RegisterHandler(handler ...cfacade.IHandler)

func RegisterHandlerGroup added in v1.1.5

func RegisterHandlerGroup(group ...*chandler.HandlerGroup)

func RequestRemote added in v1.1.29

func RequestRemote(nodeId string, route string, arg proto.Message, reply proto.Message, timeout ...time.Duration) int32

func RequestRemoteByRoute added in v1.1.29

func RequestRemoteByRoute(route string, arg proto.Message, reply proto.Message, timeout ...time.Duration) int32

func Run added in v1.1.5

func Run(isFrontend bool, nodeMode NodeMode)

func SetDataCompression added in v1.1.29

func SetDataCompression(compression bool)

func SetDictionary added in v1.1.5

func SetDictionary(dict map[string]uint16)

func SetHandlerOptions added in v1.1.5

func SetHandlerOptions(opts ...chandler.Option)

func SetHandshake added in v1.1.5

func SetHandshake(key string, value interface{})

func SetHeartbeat added in v1.1.5

func SetHeartbeat(t time.Duration)

func SetOnShutdown added in v1.1.5

func SetOnShutdown(fn ...func())

func SetPacketCodec added in v1.1.5

func SetPacketCodec(codec cfacade.IPacketCodec)

func SetSerializer added in v1.1.5

func SetSerializer(serializer cfacade.ISerializer)

Types

type Application

type Application struct {
	cfacade.INode
	cfacade.ISerializer
	cfacade.IPacketCodec
	// contains filtered or unexported fields
}

func App added in v1.1.3

func App() *Application

func NewApp

func NewApp(profilePath, profileName, nodeId string) *Application

NewApp create new application instance

func (*Application) All

func (a *Application) All() []cfacade.IComponent

func (*Application) DieChan added in v1.1.22

func (a *Application) DieChan() chan bool

func (*Application) Find

func (a *Application) Find(name string) cfacade.IComponent

func (*Application) IsFrontend added in v1.1.6

func (a *Application) IsFrontend() bool

func (*Application) NodeMode added in v1.1.6

func (a *Application) NodeMode() NodeMode

func (*Application) OnShutdown added in v1.1.0

func (a *Application) OnShutdown(fn ...func())

func (*Application) Register added in v1.1.5

func (a *Application) Register(components ...cfacade.IComponent)

func (*Application) Remove

func (a *Application) Remove(name string) cfacade.IComponent

Remove remove component by name

func (*Application) Running

func (a *Application) Running() bool

func (*Application) SetPacketCodec added in v1.1.0

func (a *Application) SetPacketCodec(codec cfacade.IPacketCodec)

func (*Application) SetSerializer added in v1.1.0

func (a *Application) SetSerializer(serializer cfacade.ISerializer)

func (*Application) Shutdown

func (a *Application) Shutdown()

func (*Application) StartTime added in v1.1.0

func (a *Application) StartTime() string

func (*Application) Startup

func (a *Application) Startup(components ...cfacade.IComponent)

Startup load components before startup

type NodeMode added in v1.1.6

type NodeMode byte
const (
	Cluster    NodeMode = 1 // 集群模式
	Standalone NodeMode = 2 // 单机模式
)

Directories

Path Synopsis
_examples
component
gin
Package cherryGin from https://github.com/gin-contrib/zap/
Package cherryGin from https://github.com/gin-contrib/zap/
orm
components
cron Module
data-config Module
etcd Module
gin Module
gops Module
gorm Module
mongo Module
examples module
extend
base58
Package cherryBase58 file from https://github.com/akamensky/base58/blob/master/base58.go
Package cherryBase58 file from https://github.com/akamensky/base58/blob/master/base58.go
map
Package cherryMap file from https://github.com/beego/beego/blob/develop/core/utils/safemap.go
Package cherryMap file from https://github.com/beego/beego/blob/develop/core/utils/safemap.go
mapstructure
Package cherryMapStructure exposes functionality to convert one arbitrary Go type into another, typically to convert a map[string]interface{} into a native Go structure.
Package cherryMapStructure exposes functionality to convert one arbitrary Go type into another, typically to convert a map[string]interface{} into a native Go structure.
net
regex
Package cherryRegex file from https://github.com/gogf/gf
Package cherryRegex file from https://github.com/gogf/gf
slice
Package cherrySlice code from: https://github.com/beego/beego/blob/develop/core/utils/slice.go
Package cherrySlice code from: https://github.com/beego/beego/blob/develop/core/utils/slice.go
snowflake
Package cherrySnowflake code from: https://github.com/bwmarrin/snowflake snowflake provides a very simple Twitter snowflake generator and parser.
Package cherrySnowflake code from: https://github.com/bwmarrin/snowflake snowflake provides a very simple Twitter snowflake generator and parser.
sync
Package cherrySync cherrySync file from https://github.com/beego/beego/blob/develop/core/utils/safemap.go
Package cherrySync cherrySync file from https://github.com/beego/beego/blob/develop/core/utils/safemap.go
time
Package cherryTime code from: https://github.com/golang-module/carbon
Package cherryTime code from: https://github.com/golang-module/carbon
utils
Package cherryUtils file from https://github.com/gogf/gf
Package cherryUtils file from https://github.com/gogf/gf
rotatelogs
Package rotatelogs is a port of File-RotateLogs from Perl (https://metacpan.org/release/File-RotateLogs), and it allows you to automatically rotate output files when you write to them according to the filename pattern that you can specify.
Package rotatelogs is a port of File-RotateLogs from Perl (https://metacpan.org/release/File-RotateLogs), and it allows you to automatically rotate output files when you write to them according to the filename pattern that you can specify.
net

Jump to

Keyboard shortcuts

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