func TestBuild(t *testing.T) { // ms == messageSender ms, err := network.NewTCPServer(9988) if err != nil { t.Fatal(err) } // mh == messageHandler mh0, err := quorum.CreateState(ms, 0) if err != nil { t.Fatal(err) } mh1, err := quorum.CreateState(ms, 1) if err != nil { t.Fatal(err) } mh0.AddParticipant(mh1.Self(), 1) mh1.AddParticipant(mh0.Self(), 0) mh0.Start() mh1.Start() time.Sleep(time.Second) }
func main() { // ms == messageSender ms, err := network.NewTCPServer(9988) if err != nil { println("fail") } // mh == messageHandler mh0, err := quorum.CreateState(ms, 0) if err != nil { println("fail") } mh1, err := quorum.CreateState(ms, 1) if err != nil { println("fail") } mh0.AddParticipant(mh1.Self(), 1) mh1.AddParticipant(mh0.Self(), 0) mh0.Start() mh1.Start() time.Sleep(time.Second) }
func TestNetworkedQuorum(t *testing.T) { // create a tcp server and 2 states // ms == messageSender ms, err := network.NewTCPServer(9980) if err != nil { println("fail") } // mh == messageHandler _, err = quorum.CreateState(ms) if err != nil { println("fail") } _, err = quorum.CreateState(ms) if err != nil { println("fail") } // more code here }
func TestNetworkedQuorum(t *testing.T) { // create a MessageRouter and 4 participants rpcs, err := network.NewRPCServer(9988) if err != nil { println("message sender creation failed") } s0, err := quorum.CreateState(rpcs) if err != nil { println("s0 creation failed") } s1, err := quorum.CreateState(rpcs) if err != nil { println("s1 creation failed") } s2, err := quorum.CreateState(rpcs) if err != nil { println("s2 creation failed") } s3, err := quorum.CreateState(rpcs) if err != nil { println("s3 creation failed") } s0.JoinSia() s1.JoinSia() s2.JoinSia() s3.JoinSia() // Basically checking for errors up to this point if testing.Short() { t.Skip() } time.Sleep(3 * common.StepDuration * time.Duration(common.QuorumSize)) // if no seg faults, no errors // there needs to be a s0.ParticipantStatus() call returning a function with public information about the participant // there needs to be a s0.QuorumStatus() call returning public information about the quorum // all participants in a public quorum should return the same information }
func establishQuorum() { var port int print("Port number: ") fmt.Scanf("%d", &port) networkServer, err := network.NewRPCServer(port) if err != nil { println(err) return } s, err := quorum.CreateState(networkServer) s.JoinSia() select {} }
func establishQuorum() { networkServer, err := network.NewTCPServer(9988) if err != nil { println(err) return } participant, err := quorum.CreateState(networkServer) if err != nil { println(err) return } participant.JoinSia() select {} }