func NewServer(id int, confile string) raftServer { debug := 0 total := 0 conf, er := os.Open(confile) if er != nil { log.Fatal(er) } inp := bufio.NewScanner(conf) for inp.Scan() { inp.Text() total += 1 } serv := cluster.NewServer(id, confile) new_serv := node{id, total, -1, false, true, -1, 0, make(chan bool), serv, debug} go RunForever(&new_serv, id, total, debug) return &new_serv }
func NewServer(id int, confile string) raftServer { debug := 0 total := 0 conf, er := os.Open(confile) if er != nil { log.Fatal(er) } inp := bufio.NewScanner(conf) for inp.Scan() { inp.Text() total += 1 } serv := cluster.NewServer(id, confile) statemachine := sm.NewStatemachine(id) var Log []LogItem new_serv := node{id, -1, total, 0, false, true, -1, 0, make(chan bool), serv, statemachine, debug, make(chan *LogItem), make(chan interface{}), make(chan interface{}), Log, 0, 0, make([]int, total), make([]int, total)} go RunForever(&new_serv, total, debug) return &new_serv }