Пример #1
0
    def __get_available_game_ids():
        """
            Returns all the available games from the queue.

            :rtype: list

            :postcondition: all(isinstance(r, str) for r in ret
        """
        game_ids = RedisUtil.get(GameAService.__AVAILABLE_GAME_IDS_REDIS_KEY, [])
        assert isinstance(game_ids, list)

        return game_ids
Пример #2
0
    def __get_game(game_id):
        """
            Returns the game by id

            :param game_id: The game id to retrieve.

            :rtype: Game

            :precondition: len(game_id) > 0
        """
        assert isinstance(game_id, str)
        assert game_id

        game = RedisUtil.get(GameAService.__GAME_DETAILS_REDIS_KEY % game_id)
        assert isinstance(game, Game)

        return game