memorymatch

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package memorymatch provides a channel-based matchmaking system for player pairing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryMatchClient

type MemoryMatchClient struct {
	// contains filtered or unexported fields
}

MemoryMatchClient implements thread-safe channel-based player matching.

func NewMemoryMatchClient

func NewMemoryMatchClient() *MemoryMatchClient

NewMemoryMatchClient returns an initialized MemoryMatchClient.

func (*MemoryMatchClient) RequestMatch

func (m *MemoryMatchClient) RequestMatch(ctx context.Context, playerID string, gameID string) (<-chan []string, error)

RequestMatch implements the channel-based matchmaking system:

  • If queue is empty, creates a new connection and returns nil (player has a channel)
  • If queue has players, finds a matching player and returns MatchFound with a channel
  • If matching fails, player is requeued

type PlayerConnection

type PlayerConnection struct {
	PlayerID  string
	MessageCh chan []string
}

PlayerConnection encapsulates player data and channel for communication.

Jump to

Keyboard shortcuts

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