本文整理汇总了Python中drogulus.dht.routingtable.RoutingTable.touch_bucket方法的典型用法代码示例。如果您正苦于以下问题:Python RoutingTable.touch_bucket方法的具体用法?Python RoutingTable.touch_bucket怎么用?Python RoutingTable.touch_bucket使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类drogulus.dht.routingtable.RoutingTable
的用法示例。
在下文中一共展示了RoutingTable.touch_bucket方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_touch_bucket
# 需要导入模块: from drogulus.dht.routingtable import RoutingTable [as 别名]
# 或者: from drogulus.dht.routingtable.RoutingTable import touch_bucket [as 别名]
def test_touch_bucket(self):
"""
Ensures that the last_accessed field of the affected k-bucket isi
updated appropriately.
"""
parent_node_id = 'deadbeef'
r = RoutingTable(parent_node_id)
# At this point the single k-bucket in the routing table will have a
# lastAccessed time of 0 (zero). Sanity check.
self.assertEqual(0, r._buckets[0].last_accessed)
# Since all keys are in the range of the single k-bucket any key will
# do for the purposes of testing.
r.touch_bucket('abc')
self.assertNotEqual(0, r._buckets[0].last_accessed)