Ejemplo n.º 1
0
// Initialization function
//@parameters :
func EntryPoint(debug chan int) (chan int, chan string, chan string, chan string, chan string, chan string) {
	pMap := connector.GetProcesses()
	var p = make([]int, len(pMap))
	i := 0
	for v, _ := range pMap {
		p[i] = v
		i++
	}
	//
	slotsManager.EntryPoint()
	trustChan, promChan, valueChan, slotChan := proposer.EntryPoint(p, debug)
	prepChan, acceptChan := acceptor.EntryPoint(p)
	learnChan := learner.EntryPoint(len(p), slotChan)
	return trustChan, prepChan, promChan, acceptChan, learnChan, valueChan
}
Ejemplo n.º 2
0
func main() {
	//Entry point of the application
	process = connector.GetProcesses()
	ownProcess, _ = connector.GetOwnProcess()
	//Create the connection
	go createServer()

	//Take the ids of all the processess
	keys := make([]int, len(process))
	i := 0
	for k, _ := range process {
		keys[i] = k
		i++
	}
	//Call paxos and assign the channels
	handlTrustChan, inPrepChan, handlPromiseLeaderChan, inAcceptChan, learnChan, valueChan = paxosMain.EntryPoint(debug)
	//Launch Leader Election
	handlSuspectChan, handlRecoveryChan, handlTrustLeaderChan = leaderElection.EntryPoint(keys, handlTrustChan)
	//Launch Failure Detector
	handlHBReplyChan, handlHBRequChan = failureDetector.EntryPoint(delay, keys)

	<-endChan

}