// 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;
}
}