本文整理汇总了Python中mongo_connector.locking_dict.LockingDict.dict方法的典型用法代码示例。如果您正苦于以下问题:Python LockingDict.dict方法的具体用法?Python LockingDict.dict怎么用?Python LockingDict.dict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mongo_connector.locking_dict.LockingDict
的用法示例。
在下文中一共展示了LockingDict.dict方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_upgrade_oplog_progress
# 需要导入模块: from mongo_connector.locking_dict import LockingDict [as 别名]
# 或者: from mongo_connector.locking_dict.LockingDict import dict [as 别名]
def test_upgrade_oplog_progress(self):
first_oplog_ts1 = self.opman1.oplog.find_one()['ts']
first_oplog_ts2 = self.opman2.oplog.find_one()['ts']
# Old format oplog progress file:
progress = {
str(self.opman1.oplog): bson_ts_to_long(first_oplog_ts1),
str(self.opman2.oplog): bson_ts_to_long(first_oplog_ts2)
}
# Set up oplog managers to use the old format.
oplog_progress = LockingDict()
oplog_progress.dict = progress
self.opman1.oplog_progress = oplog_progress
self.opman2.oplog_progress = oplog_progress
# Cause the oplog managers to update their checkpoints.
self.opman1.update_checkpoint(first_oplog_ts1)
self.opman2.update_checkpoint(first_oplog_ts2)
# New format should be in place now.
new_format = {
self.opman1.replset_name: first_oplog_ts1,
self.opman2.replset_name: first_oplog_ts2
}
self.assertEqual(
new_format,
self.opman1.oplog_progress.get_dict()
)
self.assertEqual(
new_format,
self.opman2.oplog_progress.get_dict()
)