mirror of
https://github.com/EchoVault/SugarDB.git
synced 2025-10-14 04:03:50 +08:00
Repetetive broadcast of raft join request message until a join signal is received on a dedicated channel.
Handle multiple types of Actions in NotifyMsg. Added function to check if the current server is the raft leader.
This commit is contained in:
@@ -34,7 +34,8 @@ type Server struct {
|
||||
broadcastQueue *memberlist.TransmitLimitedQueue
|
||||
numOfNodes int
|
||||
|
||||
cancelCh *chan (os.Signal)
|
||||
cancelCh *chan (os.Signal)
|
||||
raftJoinCh *chan (struct{})
|
||||
}
|
||||
|
||||
func (server *Server) Lock() {
|
||||
@@ -201,9 +202,10 @@ func main() {
|
||||
cancelCh := make(chan (os.Signal), 1)
|
||||
signal.Notify(cancelCh, syscall.SIGINT, syscall.SIGTERM)
|
||||
|
||||
raftJoinCh := make(chan struct{})
|
||||
|
||||
server := &Server{
|
||||
cancelCh: &cancelCh,
|
||||
config: config,
|
||||
config: config,
|
||||
|
||||
broadcastQueue: new(memberlist.TransmitLimitedQueue),
|
||||
numOfNodes: 0,
|
||||
@@ -213,6 +215,9 @@ func main() {
|
||||
NewSetGetCommand(),
|
||||
NewListCommand(),
|
||||
},
|
||||
|
||||
cancelCh: &cancelCh,
|
||||
raftJoinCh: &raftJoinCh,
|
||||
}
|
||||
|
||||
go server.Start()
|
||||
|
Reference in New Issue
Block a user