12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|
// 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"];
// 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"];
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;
// 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"];
// 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;
}
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;
}
// 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;
}
|