Kademlia routing table and distance metric

冷暖自知 提交于 2019-12-07 03:16:32

问题


Its been the first time I read about Kademlia today, and some points I don't think I got them right.

The distance between nodes and keys is the xor of their values.

So, if I have key x and node y, the distance between them is x xor y.

But why what is the point to bucket the nodes I know about and order them by the prefix length ? That doesn't seem to be connected directly with the xor of node IDs to find closests nodes to me ?

When I get a request for a value I search in the nodes in the closests buckets to me, that is the nodes which have the largest shared prefix with me, ie the first few buckets of the 160 buckets ?

or instead I check all nodes I know about in all the buckets and I calculate the xor between the key I am looking for, and those nodes IDs, and then send my request to the top k matches based on the xoring results with the key ID ?

Sorry I am a bit new to DHTs, and found the explanations online a bit not clear.


回答1:


I think I got it. The common prefix same bucket thing is indeed directly related to the xor values, so its indeed sorting them. I found those slides pretty helpful: http://heim.ifi.uio.no/michawe/teaching/p2p-ws08/p2p-5-6.pdf



来源:https://stackoverflow.com/questions/13494498/kademlia-routing-table-and-distance-metric

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!