本文整理匯總了Python中DatabaseManager.DatabaseManager.increment_medal_tally方法的典型用法代碼示例。如果您正苦於以下問題:Python DatabaseManager.increment_medal_tally方法的具體用法?Python DatabaseManager.increment_medal_tally怎麽用?Python DatabaseManager.increment_medal_tally使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DatabaseManager.DatabaseManager
的用法示例。
在下文中一共展示了DatabaseManager.increment_medal_tally方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: DBServerFunctions
# 需要導入模塊: from DatabaseManager import DatabaseManager [as 別名]
# 或者: from DatabaseManager.DatabaseManager import increment_medal_tally [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)