private void installNewConfigButton_Click(object sender, EventArgs e) { configTextBox.Clear(); configTextBox.AppendText("Installing new configuration..."); DemoLib.InstallNewConfiguration(); initialConfig = false; reconfigSampler = DemoLib.NewSampler(); configTextBox.Clear(); configTextBox.AppendText(DemoLib.PrintCurrentConfiguration() + "\n"); }
public Form1() { InitializeComponent(); consistencyChoices = new List <string> { "strong consistency", "causal consistency", "bounded staleness", "read my writes", "monotonic freshness", "eventual consistency" }; consistencyListBox.DataSource = consistencyChoices; consistencyListBox.ClearSelected(); readWriteWorker = new BackgroundWorker(); readWriteWorker.DoWork += new DoWorkEventHandler(ReadWriteWorker_DoWork); readWriteWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(ReadWriteWorker_Completed); Print("Running demo program..."); DemoLib.RegisterLogger(Print); // // Create initial configuration // Print("Reading configuration..."); DemoLib.Initialize(); Print(DemoLib.PrintCurrentConfiguration()); // Read sample data from file Print("Reading file data..."); initialSampler = DemoLib.NewSampler(); reconfigSampler = DemoLib.NewSampler(); DemoLib.ReadDataFile(initialSampler); Print(DemoLib.PrintReadWriteTimes(initialSampler)); // Ping servers to measure and record round-trip times in the server state Print("Pinging servers..."); DemoLib.PingAllServers(); Print("Round-trip latencies to sites:"); Print(DemoLib.PrintServerRTTs()); }
private void setReplicasButton_Click(object sender, EventArgs e) { ReplicaConfiguration config = DemoLib.GetCurrentConfiguration(); config.PrimaryServers.Clear(); config.SecondaryServers.Clear(); config.NonReplicaServers.Clear(); string server = DemoLib.ServerName("West US"); if (radioButtonWestUSPrimary.Checked) { config.PrimaryServers.Add(server); } else if (radioButtonWestUSSecondary.Checked) { config.SecondaryServers.Add(server); } else { config.NonReplicaServers.Add(server); } server = DemoLib.ServerName("East US"); if (radioButtonEastUSPrimary.Checked) { config.PrimaryServers.Add(server); } else if (radioButtonEastUSSecondary.Checked) { config.SecondaryServers.Add(server); } else { config.NonReplicaServers.Add(server); } server = DemoLib.ServerName("South US"); if (radioButtonSouthUSPrimary.Checked) { config.PrimaryServers.Add(server); } else if (radioButtonSouthUSSecondary.Checked) { config.SecondaryServers.Add(server); } else { config.NonReplicaServers.Add(server); } server = DemoLib.ServerName("North US"); if (radioButtonNorthUSPrimary.Checked) { config.PrimaryServers.Add(server); } else if (radioButtonNorthUSSecondary.Checked) { config.SecondaryServers.Add(server); } else { config.NonReplicaServers.Add(server); } server = DemoLib.ServerName("West Europe"); if (radioButtonWestEuropePrimary.Checked) { config.PrimaryServers.Add(server); } else if (radioButtonWestEuropeSecondary.Checked) { config.SecondaryServers.Add(server); } else { config.NonReplicaServers.Add(server); } server = DemoLib.ServerName("North Europe"); if (radioButtonNorthEuropePrimary.Checked) { config.PrimaryServers.Add(server); } else if (radioButtonNorthEuropeSecondary.Checked) { config.SecondaryServers.Add(server); } else { config.NonReplicaServers.Add(server); } server = DemoLib.ServerName("East Asia"); if (radioButtonAsiaPrimary.Checked) { config.PrimaryServers.Add(server); } else if (radioButtonAsiaSecondary.Checked) { config.SecondaryServers.Add(server); } else { config.NonReplicaServers.Add(server); } server = DemoLib.ServerName("Brazil"); if (radioButtonBrazilPrimary.Checked) { config.PrimaryServers.Add(server); } else if (radioButtonBrazilSecondary.Checked) { config.SecondaryServers.Add(server); } else { config.NonReplicaServers.Add(server); } initialConfig = false; reconfigSampler = DemoLib.NewSampler(); DemoLib.SetCurrentConfiguration(config); }