本文整理匯總了Golang中github.com/cs733-iitb/cluster.Server.Inbox方法的典型用法代碼示例。如果您正苦於以下問題:Golang Server.Inbox方法的具體用法?Golang Server.Inbox怎麽用?Golang Server.Inbox使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cs733-iitb/cluster.Server
的用法示例。
在下文中一共展示了Server.Inbox方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: check_Inbox
// Following function handles Incoming at Inbox from other peers.It reads those Event and forwards to StateMachine
func (rn *RaftNode) check_Inbox(node cluster.Server) {
for {
env := <-node.Inbox()
switch env.Msg.(type) {
// this packet is APPENDENTRIESRESP:
case APPENDENTRIESRESP:
temp := env.Msg.(APPENDENTRIESRESP)
rn.sm.SMchanels.netCh <- temp
//this packet is APPENDENTRIESREQ:
case APPENDENTRIESREQ:
temp := env.Msg.(APPENDENTRIESREQ)
rn.sm.SMchanels.netCh <- temp
// this packet is VOTERESP
case VOTERESP:
// fmt.Println("VOTERESp");
temp := env.Msg.(VOTERESP)
rn.sm.SMchanels.netCh <- temp
case VOTEREQ:
temp := env.Msg.(VOTEREQ)
rn.sm.SMchanels.netCh <- temp
}
}
} //End of check_Inbox function
示例2: processInbox
//Process to listen incomming packets from other Servers.
func processInbox(server cluster.Server, sm *State_Machine) {
for {
env := <-server.Inbox()
switch env.Msg.(type) {
case VoteReq:
sm.CommMedium.netCh <- env.Msg
case VoteResp:
sm.CommMedium.netCh <- env.Msg
case AppEntrReq:
sm.CommMedium.netCh <- env.Msg
case AppEntrResp:
sm.CommMedium.netCh <- env.Msg
}
}
}