Megatest

Artifact [922bb8feb0]
Login

Artifact 922bb8feb02c84fe09404152247f5487b289c6fb:


//  Copyright 2006-2017, Matthew Welland.
// 
// This file is part of Megatest.
// 
//     Megatest is free software: you can redistribute it and/or modify
//     it under the terms of the GNU General Public License as published by
//     the Free Software Foundation, either version 3 of the License, or
//     (at your option) any later version.
// 
//     Megatest is distributed in the hope that it will be useful,
//     but WITHOUT ANY WARRANTY; without even the implied warranty of
//     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//     GNU General Public License for more details.
// 
//     You should have received a copy of the GNU General Public License
//     along with Megatest.  If not, see <http://www.gnu.org/licenses/>.
digraph G {

// connecting to server
subgraph cluster_1 {
  label="Connect";
  
  node [style=filled,shape=box];
  dotserver [label="Have .server file?"];
  connect [label="Connect to server"];
  // startserver [label="Start Server"];
  connected [label="Connection Successful"];
  anylive [label="Any live servers?"];
  askstart [label="Ask existing server to start a new server"];
  anydboard [label="Any live dashboards"];
  askdboard [label="Ask dashboard to start server"];
  serverlaunch [label="User server launch to start server process"];
  wait5sec [label="Wait 5 seconds"];
  
  dotserver -> connect [label="yes"];
  connect -> connected [label="yes"];
  connect -> anylive [label="no"];

  // startserver -> anylive;
  anylive -> askstart [label="yes"];
  anylive -> anydboard [label="no"];
  anydboard -> askdboard [label="yes"];
  anydboard -> serverlaunch [label="no"];
  serverlaunch -> wait5sec;
  askdboard -> wait5sec;
  askstart -> wait5sec;
  wait5sec -> dotserver;

}

// server bootstrap
subgraph cluster_2 {
  label="Startup";
  node [style=filled,shape=box];
  getlock [label="Get file lock"];
  starthttpcpdb [label="Start http server/copy db to /tmp"];
  createsrvfile [label="Create .nnn.server file containing host:port"];
  releaselock [label="Release file lock"];
  chksrv [label="Check if server already exists"];
  exitstartup [label="exit/stop"];
  sleep1 [label="Sleep few seconds"];
  
  getlock -> starthttpcpdb [label="yes"];
  getlock -> chksrv [label="no"];
  starthttpcpdb -> createsrvfile -> releaselock;
  chksrv -> exitstartup [label="yes"];
  chksrv -> sleep1 [label="no"];
  sleep1 -> getlock;
}

// shutting down server
subgraph cluster_3 {
  label="Shutdown";
  node [style=filled,shape=box];
  shutdown [label="Start Shutdown"];
  rejectmode [label="Put http server into reject requests mode"];
  syncback [label="Sync db back"];
  removesrvfile [label="Remove server file containing host:port"];
  exit [label="Exit process"];

  shutdown -> rejectmode -> syncback -> removesrvfile -> exit;
}

//     subgraph cluster_1 {
//         node [style=filled,shape=box];
// 
// 	check_available_queue       -> remove_entries_over_10s_old;
// 	remove_entries_over_10s_old -> set_available [label="num_avail < 3"];
// 	remove_entries_over_10s_old -> exit [label="num_avail > 2"];
// 
// 	set_available               -> delay_2s;
// 	delay_2s          -> check_place_in_queue;
// 
// 	check_place_in_queue        -> "http:transport-launch" [label="at head"];
// 	check_place_in_queue        -> exit [label="not at head"];
// 
// 	"client:login"              -> "server:shutdown" [label="login failed"];
// 	"server:shutdown"           -> exit;	
// 
// 	subgraph cluster_2 {
// 		"http:transport-launch"       -> "http:transport-run";
// 		"http:transport-launch"       -> "http:transport-keep-running";
// 
// 		"http:transport-keep-running" -> "tests running?";
// 		"tests running?"              -> "client:login" [label=yes];
// 		"tests running?"              -> "server:shutdown" [label=no];
// 		"client:login"                -> delay_5s [label="login ok"];
// 		delay_5s                      -> "http:transport-keep-running";
// 	}
// 
// 	// start_server -> "server_running?";
// 	// "server_running?" -> set_available [label="no"];
// 	// "server_running?" -> delay_2s [label="yes"];
// 	// delay_2s -> "still_running?";
// 	// "still_running?" -> ping_server [label=yes];
// 	// "still_running?" -> set_available [label=no];
// 	// ping_server -> exit [label=alive];
// 	// ping_server -> remove_server_record [label=dead];
// 	// remove_server_record -> set_available;
// 	// set_available -> avail_delay [label="delay 3s"];
// 	// avail_delay -> "first_in_queue?";
// 	// 
// 	// "first_in_queue?" -> set_running [label=yes];
// 	// set_running -> get_next_port -> handle_requests;
// 	// "first_in_queue?" -> "dead_entry_in_queue?" [label=no];
// 	// "dead_entry_in_queue?" -> "server_running?" [label=no];
// 	// "dead_entry_in_queue?" -> "remove_dead_entries" [label=yes];
// 	// remove_dead_entries -> "server_running?";
// 	// 
// 	// handle_requests -> start_shutdown [label="no traffic\nno running tests"];
// 	// handle_requests -> shutdown_request;
// 	// start_shutdown -> shutdown_delay;
// 	// shutdown_request -> shutdown_delay;
// 	// shutdown_delay -> exit;
// 	
//         label = "server:launch";
//         color=brown;
//     }

//     client_start_server -> start_server;
//     handle_requests -> read_write;
//     read_write -> handle_requests;
}