Files
gomoku/server/database/errors.go
T
tiennm99 acf08669dd feat(database): new domain model for PVP/PVE/spectator with thread-safe store
- Split monolithic database.go/model.go/gomoku.go into focused files:
  player.go, room.go, store.go, errors.go, events.go, cleanup.go
- NewRoom embeds game.Board directly; carries blackPlayerId, whitePlayerId,
  currentTurn, moveHistory, spectators, owner, type, difficulty from caro domain
- Store singleton with sync.RWMutex: RegisterPlayer, CreatePvpRoom, CreatePveRoom,
  JoinNewRoom, LeaveNewRoom, WatchNewRoom, UnwatchNewRoom, BroadcastToNewRoom
- PVE rooms randomly assign human to Black or White; AI takes opposite side
- legacy.go shim keeps server/state/*.go and state/game/gomoku.go compiling
  without modification until phase-06 rewrites them
- consts/const.go: add RoomTypePvp/Pve, Status*, RoomStatus*, Difficulty* enums
2026-04-11 13:30:58 +07:00

15 lines
569 B
Go

// Package database provides the in-memory domain model and store for the Gomoku server.
// All state is volatile — server restart clears everything.
package database
import "errors"
// Exported sentinel errors for store operations.
var (
ErrRoomNotFound = errors.New("room not found")
ErrRoomFull = errors.New("room is full")
ErrRoomPlaying = errors.New("room is already playing")
ErrInvalidDifficulty = errors.New("difficulty must be 1 (easy), 2 (medium), or 3 (hard)")
ErrNotOwner = errors.New("player is not the room owner")
)