當前位置: 首頁>>代碼示例>>Python>>正文


Python DatabaseManager.get_score方法代碼示例

本文整理匯總了Python中DatabaseManager.DatabaseManager.get_score方法的典型用法代碼示例。如果您正苦於以下問題:Python DatabaseManager.get_score方法的具體用法?Python DatabaseManager.get_score怎麽用?Python DatabaseManager.get_score使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DatabaseManager.DatabaseManager的用法示例。


在下文中一共展示了DatabaseManager.get_score方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: DBServerFunctions

# 需要導入模塊: from DatabaseManager import DatabaseManager [as 別名]
# 或者: from DatabaseManager.DatabaseManager import get_score [as 別名]
class DBServerFunctions(ServerFunctions):
    """Implements functions for the DBServer.

    Arguments:
    server -- The active server object implementing these methods.
    """
    def __init__(self, server):
        self.db_mgr = DatabaseManager()
        ServerFunctions.__init__(self, server)

    def set_score(self, event_type, score, timestamp):
        """Sets the score for a given event via RPC to the DB Manager.

        Always called by ScoreKeeper.

        Arguments:
        event_type -- String for one of the Olympic events.
        score -- String for the updated score.
        timestamp -- Time of the update.
        """
        return self.db_mgr.set_score(event_type, score, timestamp)

    def get_score(self, event_type, client_id):
        """Returns synced vector clock and current score for a given event via RPC to the DB Manager.

        Always called by ScoreKeeper.

        First syncs vector clock with the vector clock passed in.

        Arguments:
        event_type -- String for one of the Olympic events.
        client_id -- Unique string ID of the initial requesting client (used for raffle).
        vector_clock_str -- String representation of the vector clock of the frontend server.
        """
#        synched_clock_str = self.server.sync_with_vector_clock(vector_clock_str)
#        self.db_mgr.check_raffle(client_id, synched_clock_str)
        return self.db_mgr.get_score(event_type)

    def increment_medal_tally(self, team_name, medal_type, timestamp):
        """Increments the medal tally for a given team via RPC to the DB Manager.

        Always called by ScoreKeeper.

        Arguments:
        team_name -- String for one of the Olympic teams.
        medal_type -- String for the type of medal to increment.
        timestamp -- Time of the update.
        """
        return self.db_mgr.increment_medal_tally(team_name, medal_type, timestamp)

    def get_medal_tally(self, team_name, client_id):
        """Returns synced vector clock and current medal tally for a given team via RPC to the DB Manager.

        Always called by ScoreKeeper.

        First syncs vector clock with the vector clock passed in.

        Arguments:
        team_name -- String for one of the Olympic teams.
        client_id -- Unique string ID of the initial requesting client (used for raffle).
        vector_clock_str -- String representation of the vector clock of the frontend server.
        """
#        synched_clock_str = self.server.sync_with_vector_clock(vector_clock_str)
#        self.db_mgr.check_raffle(client_id, synched_clock_str)
        return self.db_mgr.get_medal_tally(team_name)
開發者ID:jwnewman,項目名稱:asterix,代碼行數:67,代碼來源:DatabaseServer.py


注:本文中的DatabaseManager.DatabaseManager.get_score方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。