mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
raft: use RawNode for node's event loop
It has always bugged me that any new feature essentially needed to be tested twice due to the two ways in which apps can use raft (`*node` and `*RawNode`). Due to upcoming testing work for joint consensus, now is a good time to rectify this somewhat. This commit removes most logic from `(*node).run` and uses `*RawNode` internally. This simplifies the logic and also lead (via debugging) to some insight on how the semantics of the approaches differ, which is now documented in the comments.
This commit is contained in:
@@ -26,8 +26,8 @@ func BenchmarkOneNode(b *testing.B) {
|
||||
|
||||
n := newNode()
|
||||
s := NewMemoryStorage()
|
||||
r := newTestRaft(1, []uint64{1}, 10, 1, s)
|
||||
go n.run(r)
|
||||
rn := newTestRawNode(1, []uint64{1}, 10, 1, s)
|
||||
go n.run(rn)
|
||||
|
||||
defer n.Stop()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user