config

package
v0.0.12-entry Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToNacosServerConfigs

func ToNacosServerConfigs(scs []*NacosServerConfig) []constant.ServerConfig

Types

type Configer

type Configer[T any] interface {
	Get() *T
}

Configer provides a way to get the config.

type DelayTimerConfig

type DelayTimerConfig struct {
	InviteTimeoutMs    int64 `yaml:"invite_timeout_ms"`
	MatchTimeoutMs     int64 `yaml:"match_timeout_ms"`
	WaitAttrTimeoutMs  int64 `yaml:"wait_attr_timeout_ms"`
	ClearRoomTimeoutMs int64 `yaml:"clear_room_timeout_ms"`
}

DelayTimerConfig defines the delay timer config.

func (DelayTimerConfig) ClearRoomTimeout

func (dtc DelayTimerConfig) ClearRoomTimeout() time.Duration

func (DelayTimerConfig) InviteTimeout

func (dtc DelayTimerConfig) InviteTimeout() time.Duration

func (DelayTimerConfig) MatchTimeout

func (dtc DelayTimerConfig) MatchTimeout() time.Duration

func (DelayTimerConfig) WaitAttrTimeout

func (dtc DelayTimerConfig) WaitAttrTimeout() time.Duration

type DelayTimerType

type DelayTimerType string
const (
	DelayTimerTypeAsynq  DelayTimerType = "asynq"
	DelayTimerTypeNative DelayTimerType = "native"
)

type FileLoader

type FileLoader[T any] struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

FileLoader loads the config from file.

func NewFileLoader

func NewFileLoader[T any](path string) *FileLoader[T]

func (*FileLoader[T]) Get

func (fl *FileLoader[T]) Get() *T

type Glicko2

type Glicko2 interface {
	GetGlicko2QueueArgs(mode constant.GameMode) *glicko2.QueueArgs
}

type MatchConfig

type MatchConfig struct {
	GroupPlayerLimit int                                      `yaml:"group_player_limit"`
	MatchIntervalMs  int64                                    `yaml:"match_interval_ms"`
	Glicko2          map[constant.GameMode]*glicko2.QueueArgs `yaml:"glicko2"`
	DelayTimerType   DelayTimerType                           `yaml:"delay_timer_type"`
	DelayTimerConfig *DelayTimerConfig                        `yaml:"delay_timer_config"`
}

MatchConfig defines the global match config.

func (*MatchConfig) GetGlicko2QueueArgs

func (c *MatchConfig) GetGlicko2QueueArgs(mode constant.GameMode) *glicko2.QueueArgs

func (*MatchConfig) MatchInterval

func (c *MatchConfig) MatchInterval() time.Duration

type MatchStrategy

type MatchStrategy interface {
	GetMatchStrategy(mode constant.GameMode) constant.MatchStrategy
}

type NacosLoader

type NacosLoader struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewNacosLoader

func NewNacosLoader(namespaceID, group, dataID string, scs []*NacosServerConfig) *NacosLoader

func (*NacosLoader) Get

func (nl *NacosLoader) Get() *MatchConfig

type NacosServerConfig

type NacosServerConfig struct {
	Addr        string `yaml:"addr"`
	Port        uint64 `yaml:"port"`
	GRPCPort    uint64 `yaml:"grpc_port"`
	ContextPath string `yaml:"context_path"`
	Schema      string `yaml:"schema"`
}

type RedisOpt

type RedisOpt struct {
	Addr     string `yaml:"addr"`
	Password string `yaml:"password"`
	DB       int    `yaml:"db"`
}

type ServerConfig

type ServerConfig struct {
	HTTPPort             uint64               `yaml:"http_port"`
	OtelExporterEndpoint string               `yaml:"otel_exporter_endpoint"`
	AsynqRedis           *RedisOpt            `yaml:"asynq_redis"`
	NacosNamespaceID     string               `yaml:"nacos_namespace_id"`
	NacosServers         []*NacosServerConfig `yaml:"nacos_servers"`
}

ServerConfig defines the server config.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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