config

package
v0.0.9-config Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	GroupPlayerLimit int                `yaml:"group_player_limit"`
	MatchIntervalMs  int64              `yaml:"match_interval_ms"`
	Glicko2          *glicko2.QueueArgs `yaml:"glicko2"`
	AsynqRedis       *Redis             `yaml:"asynq_redis"`
	DelayTimerType   DelayTimerType     `yaml:"delay_timer_type"`
	DelayTimerConfig *DelayTimerConfig  `yaml:"delay_timer_config"`
}

func Load

func Load(path string) *Config

Load loads the config from file.

func (*Config) GetConfig

func (c *Config) GetConfig(_ constant.GameMode) DelayTimerConfig

func (*Config) GetQueueArgs

func (c *Config) GetQueueArgs(_ constant.GameMode) *glicko2.QueueArgs

func (*Config) MatchInterval

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

type DelayTimer

type DelayTimer interface {
	GetConfig(mode constant.GameMode) DelayTimerConfig
}

type DelayTimerConfig

type DelayTimerConfig struct {
	InviteTimeoutMs    int64 `json:"invite_timeout_ms"`
	MatchTimeoutMs     int64 `json:"match_timeout_ms"`
	WaitAttrTimeoutMs  int64 `json:"wait_attr_timeout_ms"`
	ClearRoomTimeoutMs int64 `json:"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 Glicko2

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

type MatchStrategy

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

type Redis

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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