GameServiceImpl

interface GameServiceImpl

Service interface for managing game state persistence and retrieval operations. Provides methods for saving, loading, and managing game states across different storage backends.

Inheritors

Functions

Link copied to clipboard
abstract suspend fun closeService()

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

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

Deletes a game from storage.

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

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

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

Directly loads a game state from storage by its identifier.

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

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

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

Checks if all required players have joined the game.

Link copied to clipboard
abstract suspend fun new(gameName: String, gameStateProvider: () -> GameState)

Creates a new game entry in storage.

Link copied to clipboard
abstract suspend 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
abstract suspend fun refreshBase(game: Game): GameState?

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

Link copied to clipboard
abstract suspend 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
abstract suspend 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
abstract suspend 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.