【发布时间】:2020-07-12 23:43:01
【问题描述】:
我正在尝试实现 Raft 共识算法,但由于某种原因无法使用 RPC 调用。我正在使用 labrpc.go 拨打电话。
我的函数签名:
func (rf *Raft) RequestVotes(args RequestVoteArgs, reply *RequestVoteReply) bool
还有我正在打的电话
if err := rf.peers[peerIdx].Call("Raft.RequestVotes", args, &reply); err == false {
筏结构:
type Raft struct {
...
peers []*labrpc.ClientEnd // RPC end points of all peers
...
}
但我不断收到此错误:
labrpc.Service.dispatch(): Raft.RequestVotes 中的未知方法 RequestVotes;期待 [] 之一
我还有其他几个 Raft. 方法,那么 期望 [] 之一应该是非空的吗?
【问题讨论】:
标签: go rpc distributed-system consensus raft