Interface StorageService

All Known Implementing Classes:
BucketStorageService, FileSystemStorageService

public interface StorageService
Interfaces for a storage service.
  • Method Details

    • listGames

      List<String> listGames() throws GameStorageException
      Lists available games.
      Returns:
      A list of unique string identifiers of available games.
      Throws:
      GameStorageException - If error occur while listing the games.
    • saveGame

      void saveGame(Game game) throws GameStorageException
      Saves a game.
      Parameters:
      game - Game to save.
      Throws:
      GameStorageException - If an error occurs while saving the game.
    • loadGame

      Game loadGame(String gameId) throws GameStorageException
      Loads a game.
      Parameters:
      gameId - Unique identifier of the game to load.
      Returns:
      An instance of the loaded game.
      Throws:
      GameStorageException - If an error occurs while loading the provided game.
    • deleteGame

      void deleteGame(String gameId) throws GameStorageException
      Deletes a game.
      Parameters:
      gameId - Unique identifier of the game to delete.
      Throws:
      GameStorageException - If some error occur while deleting the specified game.
    • newGame

      Game newGame(String playerName)
      Creates a new game.
      Parameters:
      playerName - The name of the player for the new game.
      Returns:
      An instance of the new game.