FakeGameService

In-memory fake implementation of GameServiceImpl for testing purposes. Stores game states in memory rather than persisting to an actual storage backend. Useful for unit tests and scenarios where real storage is not available or desired.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
Link copied to clipboard

Provides read-only access to the in-memory game storage.

Functions

Link copied to clipboard
open suspend override fun closeService()

Closes the service and releases any held resources. Should be called when the service is no longer needed.

Link copied to clipboard
open suspend override fun delete(gameName: String)

Deletes a game from storage.

Link copied to clipboard
open suspend override fun getAllGameNames(): List<String>
Link copied to clipboard
open override fun getStorageTypeName(): String

Gets the name of the storage type being used by this service.

Link copied to clipboard
open suspend override fun hardLoad(id: String): GameState?

Directly loads a game state from storage by its identifier.

Link copied to clipboard
open suspend override fun hardSave(id: String, gameState: GameState)

Directly saves a game state to storage under the given identifier.

Link copied to clipboard
open suspend override fun hasAllPlayers(game: Game): Boolean

Checks if all required players have joined the game.

Link copied to clipboard
fun load(id: String): GameState?
Link copied to clipboard
open suspend override fun new(gameName: String, gameStateProvider: () -> GameState)

Creates a new game entry in storage.

Link copied to clipboard
open suspend override fun refresh(game: Game): Game

Refreshes the game state by loading the latest version from storage. Updates the game instance with any changes made by other players.

Link copied to clipboard
open suspend override fun refreshBase(game: Game): GameState?

Loads the base game state from storage without game instance wrapping.

Link copied to clipboard
open suspend override fun runStorageHealthCheck()

Runs a health check on the storage system to verify it's functioning correctly. Creates, reads, updates, and deletes a test game state.

Link copied to clipboard
fun save(id: String, gameState: GameState)
Link copied to clipboard
open suspend override fun saveEndGame(game: Game)

Saves the final game state at the end of a game session. Handles cleanup and proper storage of winner information.

Link copied to clipboard
open suspend override fun saveOnlyBoard(gameName: String?, gameState: GameState?)

Saves only the board state and last player to storage. Used during gameplay to persist moves without modifying player information.