Documentation
¶
Index ¶
- Variables
- type Event
- type EventType
- type GameMode
- type GameModeStats
- type InvalidQueueSizeError
- type Option
- func WithAttemptToJoinFrequency(frequency time.Duration) Option
- func WithCheckDeadlinesFrequency(frequency time.Duration) Option
- func WithDefaultTimeout(timeout time.Duration) Option
- func WithLogger(logger *slog.Logger) Option
- func WithMatchBufferSize(size int) Option
- func WithOperationBufferSize(size int) Option
- func WithStatsUpdateInterval(interval time.Duration) Option
- func WithWorkerPool(numWorkers, jobBufferSize int) Option
- type Player
- type PlayerAlreadyEnqueuedError
- type PlayerNotFoundError
- type ServiceAlreadyStartedError
- type ServiceNotStartedError
- type Stats
- type Tango
- func (t *Tango) Enqueue(ctx context.Context, player Player) error
- func (t *Tango) ListMatches() ([]*match, error)
- func (t *Tango) RemovePlayer(playerID string) error
- func (t *Tango) Shutdown(ctx context.Context) error
- func (t *Tango) Start() error
- func (t *Tango) Stats(ctx context.Context) (Stats, error)
- type TangoError
Constants ¶
This section is empty.
Variables ¶
var AllGameModes = map[GameMode]struct{}{ GameModeUnknown: {}, GameMode1v1: {}, GameMode2v2: {}, GameMode3v3: {}, }
AllGameModes contains a map of all available game modes
Functions ¶
This section is empty.
Types ¶
type GameModeStats ¶
type InvalidQueueSizeError ¶
type InvalidQueueSizeError struct{ TangoError }
Enumerate package errors.
type Option ¶
type Option func(*Tango)
Options defines the function for applying optional configuration to the Tango instance.
func WithAttemptToJoinFrequency ¶
WithAttemptToJoinFrequency sets the frequency for matching attempts.
func WithCheckDeadlinesFrequency ¶
WithCheckDeadlinesFrequency sets the frequency for checking player deadlines.
func WithDefaultTimeout ¶
WithDefaultTimeout sets the default operation timeout.
func WithMatchBufferSize ¶
WithMatchBufferSize sets the buffer size for match channels.
func WithOperationBufferSize ¶
WithOperationBufferSize sets the buffer size for operation channels.
func WithStatsUpdateInterval ¶
WithStatsUpdateInterval sets how frequently stats are updated
func WithWorkerPool ¶
WithWorkerPool sets the configuration for the matchmaking worker pool.
type Player ¶
type Player struct {
ID string
IsHosting bool
GameMode GameMode
// contains filtered or unexported fields
}
Player represents a player attempting to join or host a match.
type PlayerAlreadyEnqueuedError ¶
type PlayerAlreadyEnqueuedError struct{ TangoError }
Enumerate package errors.
type ServiceAlreadyStartedError ¶
type ServiceAlreadyStartedError struct{ TangoError }
Enumerate package errors.
type ServiceNotStartedError ¶
type ServiceNotStartedError struct{ TangoError }
Enumerate package errors.
type Stats ¶
type Stats struct {
MatchesByGameMode map[GameMode]GameModeStats
TotalMatches int
TotalPlayers int
}
Stats holds information about the current state of matches
type Tango ¶
type Tango struct {
// contains filtered or unexported fields
}
Tango manages players, matches, and matchmaking.
func (*Tango) ListMatches ¶
ListMatches returns a list of all active matches.
func (*Tango) RemovePlayer ¶
RemovePlayer removes a player from the system.
type TangoError ¶
type TangoError struct {
// contains filtered or unexported fields
}
TangoError represents a base error type for the package.
func (TangoError) Error ¶
func (e TangoError) Error() string
Error returns the string representation to a TangoErroor.