This commit is contained in:
eson 2023-07-31 08:09:14 +08:00
parent 84c7e3c715
commit 39f976e52a

31
main.go
View File

@ -111,35 +111,4 @@ func StartNode(replicaID uint64, exampleShardID uint64, addr string) *dragonboat
return nh
// raftStopper.RunWorker(func() {
// // use a NO-OP client session here
// // check the example in godoc to see how to use a regular client session
// cs := nh.GetNoOPSession(exampleShardID)
// for {
// select {
// case v, ok := <-ch:
// if !ok {
// return
// }
// // remove the \n char
// msg := strings.Replace(v, "\n", "", 1)
// if cmd, addr, replicaID, err := splitMembershipChangeCmd(msg); err == nil {
// // input is a membership change request
// makeMembershipChange(nh, cmd, addr, replicaID)
// } else {
// // input is a regular message need to be proposed
// ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
// // make a proposal to update the IStateMachine instance
// _, err := nh.SyncPropose(ctx, cs, []byte(msg))
// cancel()
// if err != nil {
// fmt.Fprintf(os.Stderr, "SyncPropose returned error %v\n", err)
// }
// }
// case <-raftStopper.ShouldStop():
// return
// }
// }
// })
// raftStopper.Wait()
}