common

package
v0.0.0-...-4d53ac5 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UnknownMessage uint32 = 0
	LoginMessage   uint32 = 1
	GatewayMessage uint32 = 2
	LogicMessage   uint32 = 3
)
View Source
const BatchExecMaxMilliSecond = 30000

BatchExecMaxMilliSecond DB合并写周期 单位毫秒

View Source
const BulkWriteMax = 1000

BulkWriteMax DB合并写单个集合最大合批数量

View Source
const DBRetryCountMax = 10000
View Source
const NameLengthMax = 24 // NameLengthMax 名字 长度 最大值
View Source
const RateLimitCount = 120 // RateLimitCount 限流-数量// todo 可配置...
View Source
const RateLimitIntervalSec = 60 // RateLimitIntervalSec 限流-间隔-秒 // todo 可配置...
View Source
const ServerNameGM string = "gm" // GM服务
View Source
const ServerNameGateway string = "gateway" // 网关服
View Source
const ServerNameLogic string = "logic" // 逻辑服
View Source
const ServerNameLogin string = "login" // 登录服
View Source
const ServerNameRoom string = "room" // 房间服

Variables

View Source
var KCPHeartBeatTimeOutSec int64 = 30 // 心跳时间-秒 // todo menglc 可配置...
View Source
var LoginTokenDuration = time.Second * 60 // LoginTokenDuration 登录 token 有效持续时间
View Source
var MongodbMaxConnIdleTimeDefault = time.Minute * 5
View Source
var MongodbMaxConnectingDefault uint64 = 4 // 设置为 P/2
View Source
var MongodbMaxPoolSizeDefault uint64 = 24 // 可以设置为 2*P + 30% 的数量

////////////////////////////////////////////////////////////////////////////////////////////////// Mongodb var MongodbDatabaseNameDefault = ProjectName

View Source
var MongodbMinPoolSizeDefault uint64 = 8 // 可以设置为 P 的数量
View Source
var MongodbTimeoutDurationDefault = time.Minute
View Source
var TCPHeartBeatTimeOutSec int64 = 30 // 心跳时间-秒 // todo menglc 可配置...

Functions

func GenLogTraceID

func GenLogTraceID() string

GenLogTraceID 生成日志traceID

func GenUID

func GenUID(zid uint32, uidIdx uint64) uint64

GenUID 生成UID zid: group id uidIdx: uid 在 redis 中的序号

func GenUIDIdx

func GenUIDIdx(uid uint64) uint64

GenUIDIdx 生成UID序号

func GetServiceTypeByMessageID

func GetServiceTypeByMessageID(messageID uint32) uint32

func GetZIDByUID

func GetZIDByUID(uid uint64) uint32

GetZIDByUID 获取ZID 通过UID

func IsGatewayMessage

func IsGatewayMessage(messageID uint32) bool

func IsLogicMessage

func IsLogicMessage(messageID uint32) bool

func IsLoginMessage

func IsLoginMessage(messageID uint32) bool

func IsZoneSet

func IsZoneSet(zone1 uint32, zone2 uint32) bool

IsZoneSet 是否为同一组区域 比如zoneID为2的world和zoneID为20001的battle_gateway属于同一组区域

Types

type UUIDGenerator

type UUIDGenerator interface {
	GenUUID() (uint64, error)
}

UUIDGenerator 生成用户UUID的接口

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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