Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MatchCleaner ¶
func MatchCleaner(c *Coordinator)
func MatchMaker ¶
func MatchMaker(c *Coordinator)
func MatchWatcher ¶
func MatchWatcher(m *Session)
func QueueCleaner ¶
func QueueCleaner(c *Coordinator)
Types ¶
type Coordinator ¶
type Coordinator struct { Matches map[uuid.UUID]*Session MatchLock *sync.Mutex PlayerQueueChan chan uuid.UUID PlayerPool map[MMRPlayer]bool CallbackChan map[uuid.UUID]chan uuid.UUID }
func NewCoordinator ¶
func NewCoordinator() *Coordinator
func (*Coordinator) Coordinate ¶
func (c *Coordinator) Coordinate(cmd *SessionCommand) *SessionCommandResult
func (*Coordinator) Start ¶
func (c *Coordinator) Start()
type Session ¶
type Session struct { ID uuid.UUID Active bool Game *Game Watcher chan bool Broadcasts map[uuid.UUID]chan SessionResp LastMove time.Time // contains filtered or unexported fields }
func NewSession ¶
func NewSession() *Session
type SessionCommand ¶
type SessionCommand struct { ID uuid.UUID `json:"player_id"` MatchID uuid.UUID `json:"match_id"` Command SessionCmd `json:"command"` GameCommand *Command `json:"game_command,omitempty"` }
func (*SessionCommand) String ¶
func (s *SessionCommand) String() string
type SessionCommandResult ¶
type SessionCommandResult struct { ID uuid.UUID `json:"player_id"` MatchID uuid.UUID `json:"match_id"` Result SessionResp `json:"result"` GameResult *CommandResult `json:"game_result,omitempty"` }
func (*SessionCommandResult) String ¶
func (s *SessionCommandResult) String() string
Click to show internal directories.
Click to hide internal directories.