问题描述
// create a new Chord ring.
n.create()
predecessor := nil
successor := n
// join a Chord ring containing node n'.
n.join(n')
predecessor := nil
successor := n'.find_successor(n)
// called periodically. n asks the successor
// about its predecessor,verifies if n's immediate
// successor is consistent,and tells the successor about n
n.stabilize()
x = successor.predecessor
if x ∈ (n,successor) then
successor := x
successor.notify(n)
// n' thinks it might be our predecessor.
n.notify(n')
if predecessor is nil or n'∈(predecessor,n) then
predecessor := n'
// called periodically. refreshes finger table entries.
// next stores the index of the finger to fix
n.fix_fingers()
next := next + 1
if next > m then
next := 1
finger[next] := find_successor(n+{\displaystyle 2^{next-1}}2^{next-1});
// called periodically. checks whether predecessor has Failed.
n.check_predecessor()
if predecessor has Failed then
predecessor := nil
我正在努力理解它。我的具体问题是:predecessor
字段究竟何时才会为非空?
考虑节点 id 1 加入的情况。它的后继为1,前驱为nil。
现在说有 10 个连接的节点。其后继为1,前驱为nil。
稳定例程取决于非 nil 的前驱,在这种情况下它不是两个节点。
那么算法在这一点上是如何进行的?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)